diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b22725c891..388778095c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,7 @@ K8S_RECORD=1 ./test.sh all run-tests 1. `/Cargo.toml`: Add a new feature for the new version. -1. `/Cargo.toml`: Update `package.metadata.docs.rs.features` to the new feature. +1. `/Cargo.toml`: Update `package.metadata."docs.rs".features` to the new feature. 1. Update feature name in the `rustdoc` command in the "To make a new crate release" section below. @@ -108,7 +108,7 @@ K8S_RECORD=1 ./test.sh all run-tests ```sh rm -rf ./target/doc/ && - cargo rustdoc --features 'v1_24' -- -A 'rustdoc::bare_urls' -Z unstable-options --enable-index-page && + cargo rustdoc --features 'v1_25' -- -A 'rustdoc::bare_urls' -Z unstable-options --enable-index-page && CARGO_TARGET_DIR="$(realpath ./target)" cargo rustdoc --manifest-path ./k8s-openapi-codegen-common/Cargo.toml -- -Z unstable-options --enable-index-page && CARGO_TARGET_DIR="$(realpath ./target)" cargo rustdoc --manifest-path ./k8s-openapi-derive/Cargo.toml -- -Z unstable-options --enable-index-page && rm -rf ../k8s-openapi-gh-pages/v0.15.x && diff --git a/Cargo.toml b/Cargo.toml index 4b83d12ed7..dbd7a6bf90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,10 +59,11 @@ v1_21 = [] v1_22 = [] v1_23 = [] v1_24 = [] +v1_25 = [] [package.metadata.docs.rs] # docs.rs generates docs for the latest version. To see the docs for an older version, please generate them yourself. -features = ["v1_24"] +features = ["v1_25"] [workspace] members = [ diff --git a/build.rs b/build.rs index 693357cdea..d9a9dd8251 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,7 @@ fn main() -> Result<(), Box> { use std::io::Write; const MIN: usize = 18; - const MAX: usize = 24; + const MAX: usize = 25; println!("cargo:rerun-if-env-changed=K8S_OPENAPI_ENABLED_VERSION"); diff --git a/k8s-openapi-codegen-common/src/lib.rs b/k8s-openapi-codegen-common/src/lib.rs index a28a00fc02..d912a6c7c9 100644 --- a/k8s-openapi-codegen-common/src/lib.rs +++ b/k8s-openapi-codegen-common/src/lib.rs @@ -2049,25 +2049,51 @@ pub fn write_operation( writeln!(out, "{indent} let __request = {local}http::Request::{method}(__url);")?; + write!(out, "{indent} let __body = ")?; let body_parameter = - delete_optional_parameter.as_ref() - .or_else(|| parameters.iter().find(|(_, _, parameter)| parameter.location == swagger20::ParameterLocation::Body)); + if let Some((parameter_name, _, parameter)) = &delete_optional_parameter { + // In v1.25, as of v1.25.0, sending a DeleteCollection request with any request body triggers a server error. + // Ref: https://github.com/kubernetes/kubernetes/issues/111985 + // + // This includes a request body of `{}` corresponding to a DeleteOptional with no overridden fields. + // This use case is common enough that we make it work by special-casing it to set an empty request body instead. + // This happens to be how other language's clients behave with Delete and DeleteCollection API anyway. + // + // A DeleteOptional with one or more fields set will still serialize to a request body and thus trigger a server error, + // but that is upstream's problem to fix. - write!(out, "{indent} let __body = ")?; - if let Some((parameter_name, parameter_type, parameter)) = body_parameter { - if parameter.required { - if parameter_type.starts_with('&') { - writeln!(out, "{local}serde_json::to_vec({parameter_name}).map_err({local}RequestError::Json)?;")?; + writeln!(out, "if {parameter_name} == Default::default() {{")?; + writeln!(out, "{indent} vec![]")?; + writeln!(out, "{indent} }}")?; + writeln!(out, "{indent} else {{")?; + writeln!(out, "{indent} {local}serde_json::to_vec(&{parameter_name}).map_err({local}RequestError::Json)?")?; + writeln!(out, "{indent} }};")?; + + Some((parameter_name, parameter)) + } + else if let Some((parameter_name, parameter_type, parameter)) = parameters.iter().find(|(_, _, parameter)| parameter.location == swagger20::ParameterLocation::Body) { + if parameter.required { + if parameter_type.starts_with('&') { + writeln!(out, "{local}serde_json::to_vec({parameter_name}).map_err({local}RequestError::Json)?;")?; + } + else { + writeln!(out, "{local}serde_json::to_vec(&{parameter_name}).map_err({local}RequestError::Json)?;")?; + } } else { - writeln!(out, "{local}serde_json::to_vec(&{parameter_name}).map_err({local}RequestError::Json)?;")?; + writeln!(out)?; + writeln!(out, "{parameter_name}.unwrap_or(Ok(vec![]), |value| {local}serde_json::to_vec(value).map_err({local}RequestError::Json))?;")?; } + + Some((parameter_name, parameter)) } else { - writeln!(out)?; - writeln!(out, "{parameter_name}.unwrap_or(Ok(vec![]), |value| {local}serde_json::to_vec(value).map_err({local}RequestError::Json))?;")?; - } + writeln!(out, "vec![];")?; + None + }; + + if let Some((parameter_name, parameter)) = body_parameter { let is_patch = if let swagger20::SchemaKind::Ref(ref_path) = ¶meter.schema.kind { ref_path.path == "io.k8s.apimachinery.pkg.apis.meta.v1.Patch" @@ -2089,9 +2115,6 @@ pub fn write_operation( r#"{indent} let __request = __request.header({local}http::header::CONTENT_TYPE, {local}http::header::HeaderValue::from_static("application/json"));"#)?; } } - else { - writeln!(out, "vec![];")?; - } if operation_result_name.is_some() { writeln!(out, "{indent} match __request.body(__body) {{")?; diff --git a/k8s-openapi-codegen/src/supported_version.rs b/k8s-openapi-codegen/src/supported_version.rs index 5e165515dc..af7c670bb6 100644 --- a/k8s-openapi-codegen/src/supported_version.rs +++ b/k8s-openapi-codegen/src/supported_version.rs @@ -6,6 +6,7 @@ pub(crate) const ALL: &[SupportedVersion] = &[ SupportedVersion::V1_22, SupportedVersion::V1_23, SupportedVersion::V1_24, + SupportedVersion::V1_25, ]; #[derive(Clone, Copy, Debug)] @@ -17,6 +18,7 @@ pub(crate) enum SupportedVersion { V1_22, V1_23, V1_24, + V1_25, } impl SupportedVersion { @@ -29,6 +31,7 @@ impl SupportedVersion { SupportedVersion::V1_22 => "1.22", SupportedVersion::V1_23 => "1.23", SupportedVersion::V1_24 => "1.24", + SupportedVersion::V1_25 => "1.25", } } @@ -41,6 +44,7 @@ impl SupportedVersion { SupportedVersion::V1_22 => "v1_22", SupportedVersion::V1_23 => "v1_23", SupportedVersion::V1_24 => "v1_24", + SupportedVersion::V1_25 => "v1_25", } } @@ -53,6 +57,7 @@ impl SupportedVersion { SupportedVersion::V1_22 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.22.13/api/openapi-spec/swagger.json", SupportedVersion::V1_23 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.23.10/api/openapi-spec/swagger.json", SupportedVersion::V1_24 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.24.4/api/openapi-spec/swagger.json", + SupportedVersion::V1_25 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.25.0/api/openapi-spec/swagger.json", } } @@ -97,6 +102,11 @@ impl SupportedVersion { crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::pod_exec_command_parameter_type, ], + + SupportedVersion::V1_25 => &[ + crate::fixups::upstream_bugs::connect_options_gvk, + crate::fixups::upstream_bugs::pod_exec_command_parameter_type, + ], }; let special_fixups: &[fn(&mut crate::swagger20::Spec) -> Result<(), crate::Error>] = &[ diff --git a/k8s-openapi-tests-macro-deps/Cargo.toml b/k8s-openapi-tests-macro-deps/Cargo.toml index f43a694e2f..1bb9cea12a 100644 --- a/k8s-openapi-tests-macro-deps/Cargo.toml +++ b/k8s-openapi-tests-macro-deps/Cargo.toml @@ -22,3 +22,4 @@ test_v1_21 = ["k8s-openapi/v1_21"] test_v1_22 = ["k8s-openapi/v1_22"] test_v1_23 = ["k8s-openapi/v1_23"] test_v1_24 = ["k8s-openapi/v1_24"] +test_v1_25 = ["k8s-openapi/v1_25"] diff --git a/k8s-openapi-tests/Cargo.toml b/k8s-openapi-tests/Cargo.toml index d6503301a6..03e3c24af8 100644 --- a/k8s-openapi-tests/Cargo.toml +++ b/k8s-openapi-tests/Cargo.toml @@ -49,3 +49,4 @@ test_v1_21 = ["k8s-openapi/v1_21"] test_v1_22 = ["k8s-openapi/v1_22"] test_v1_23 = ["k8s-openapi/v1_23"] test_v1_24 = ["k8s-openapi/v1_24"] +test_v1_25 = ["k8s-openapi/v1_25"] diff --git a/k8s-openapi-tests/build.rs b/k8s-openapi-tests/build.rs index 84e45bc4cf..b2913ac6cb 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 = 18; - const MAX: usize = 24; + const MAX: usize = 25; 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/src/lib.rs b/k8s-openapi-tests/src/lib.rs index a0b04bc0b4..15323e3a8e 100644 --- a/k8s-openapi-tests/src/lib.rs +++ b/k8s-openapi-tests/src/lib.rs @@ -54,6 +54,7 @@ impl Client { #[cfg(feature = "test_v1_22")] let replays_directory = "v1-22"; #[cfg(feature = "test_v1_23")] let replays_directory = "v1-23"; #[cfg(feature = "test_v1_24")] let replays_directory = "v1-24"; + #[cfg(feature = "test_v1_25")] let replays_directory = "v1-25"; let replays_directory = std::path::Path::new(concat!(env!("CARGO_MANIFEST_DIR"))) diff --git a/k8s-openapi-tests/test-replays/v1-18/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-18/custom_resource_definition-test.json index 6ea90c64a5..e911cda10a 100644 --- a/k8s-openapi-tests/test-replays/v1-18/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-18/custom_resource_definition-test.json @@ -50,7 +50,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"d0d12e1f-1a22-4fa6-ac11-b36b2793930c\"}}\n" @@ -74,7 +74,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"selfLink\":\"/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"a2790d0a-db92-4fca-8453-26873dc1c91c\",\"resourceVersion\":\"676\",\"generation\":1,\"creationTimestamp\":\"2021-04-15T05:55:00Z\",\"deletionTimestamp\":\"2021-04-15T05:55:00Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:acceptedNames\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:conditions\":{}}}},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2021-04-15T05:55:00Z\",\"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\":{}},\"f:status\":{\"f:storedVersions\":{}}}}]},\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"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-18/job-create.json b/k8s-openapi-tests/test-replays/v1-18/job-create.json index afdafc4fe6..a3346ec144 100644 --- a/k8s-openapi-tests/test-replays/v1-18/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-18/job-create.json @@ -130,7 +130,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"selfLink\":\"/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job\",\"uid\":\"e967bd46-07e4-4b6c-a0dd-e5acea47366e\",\"resourceVersion\":\"743\",\"creationTimestamp\":\"2021-04-15T05:55:00Z\",\"deletionTimestamp\":\"2021-04-15T05:55:13Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"e967bd46-07e4-4b6c-a0dd-e5acea47366e\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2021-04-15T05:55:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"Failed\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:failed\":{},\"f:startTime\":{}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"e967bd46-07e4-4b6c-a0dd-e5acea47366e\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"e967bd46-07e4-4b6c-a0dd-e5acea47366e\",\"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\"}}},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2021-04-15T05:55:13Z\",\"lastTransitionTime\":\"2021-04-15T05:55:13Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2021-04-15T05:55:00Z\",\"failed\":1}}\n" @@ -138,7 +138,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"selfLink\":\"/api/v1/namespaces/default/pods\",\"resourceVersion\":\"744\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-d8qh2\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-create-job-d8qh2\",\"uid\":\"d82e09b3-56cf-449d-8e3b-c9626b315dc4\",\"resourceVersion\":\"744\",\"creationTimestamp\":\"2021-04-15T05:55:00Z\",\"labels\":{\"controller-uid\":\"e967bd46-07e4-4b6c-a0dd-e5acea47366e\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}}},\"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\":\"2021-04-15T05:55:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.6\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-2gfb4\",\"secret\":{\"secretName\":\"default-token-2gfb4\",\"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\":\"default-token-2gfb4\",\"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.18-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},\"status\":{\"phase\":\"Failed\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.6\",\"podIPs\":[{\"ip\":\"10.244.0.6\"}],\"startTime\":\"2021-04-15T05:55:00Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2021-04-15T05:55:12Z\",\"finishedAt\":\"2021-04-15T05:55:12Z\",\"containerID\":\"containerd://1f0fc78532524f0ecf6bad8d411cfc2327fde3ee7616d772a2b2f526cbee178b\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"containerID\":\"containerd://1f0fc78532524f0ecf6bad8d411cfc2327fde3ee7616d772a2b2f526cbee178b\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-18/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-18/patch-deployment.json index 25458b9398..4bc68171d3 100644 --- a/k8s-openapi-tests/test-replays/v1-18/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-18/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"05d8b5ab-12ca-4e02-9b00-100c57bfbfdb\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"selfLink\":\"/api/v1/namespaces/default/pods\",\"resourceVersion\":\"656\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-5c46bc57f4-qwwpz\",\"generateName\":\"k8s-openapi-tests-patch-deployment-5c46bc57f4-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-patch-deployment-5c46bc57f4-qwwpz\",\"uid\":\"23f4342c-1f4d-4fad-811d-957c598eda8d\",\"resourceVersion\":\"645\",\"creationTimestamp\":\"2021-04-15T05:55:00Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"5c46bc57f4\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-5c46bc57f4\",\"uid\":\"8efbb431-8317-49e3-8aea-fc01b5b0cc50\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"8efbb431-8317-49e3-8aea-fc01b5b0cc50\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-2gfb4\",\"secret\":{\"secretName\":\"default-token-2gfb4\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.6\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-2gfb4\",\"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.18-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},\"status\":{\"phase\":\"Pending\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"}],\"hostIP\":\"172.18.0.2\",\"startTime\":\"2021-04-15T05:55:00Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"state\":{\"waiting\":{\"reason\":\"ContainerCreating\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"alpine:3.6\",\"imageID\":\"\",\"started\":false}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-6bcdb497c-4h59r\",\"generateName\":\"k8s-openapi-tests-patch-deployment-6bcdb497c-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-patch-deployment-6bcdb497c-4h59r\",\"uid\":\"295dda1b-1c1e-441f-b7b3-4ed37b9e3cc9\",\"resourceVersion\":\"655\",\"creationTimestamp\":\"2021-04-15T05:55:00Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"6bcdb497c\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-6bcdb497c\",\"uid\":\"5384b31d-8993-4c99-a62a-d9ea98b29aba\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"5384b31d-8993-4c99-a62a-d9ea98b29aba\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-04-15T05:55:00Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-2gfb4\",\"secret\":{\"secretName\":\"default-token-2gfb4\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.7\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-2gfb4\",\"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.18-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},\"status\":{\"phase\":\"Pending\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-04-15T05:55:00Z\"}],\"hostIP\":\"172.18.0.2\",\"startTime\":\"2021-04-15T05:55:00Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"state\":{\"waiting\":{\"reason\":\"ContainerCreating\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"alpine:3.7\",\"imageID\":\"\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-19/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-19/custom_resource_definition-test.json index 59219005ac..3d03bd399b 100644 --- a/k8s-openapi-tests/test-replays/v1-19/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-19/custom_resource_definition-test.json @@ -50,7 +50,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"54438e85-b3cd-4810-9375-3d143b2dbd08\"}}\n" @@ -74,7 +74,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"selfLink\":\"/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"dbd392c5-9c40-4bfa-99c0-103a42fbebb6\",\"resourceVersion\":\"909\",\"generation\":1,\"creationTimestamp\":\"2021-10-28T05:15:02Z\",\"deletionTimestamp\":\"2021-10-28T05:15:03Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:acceptedNames\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:conditions\":{}}}},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2021-10-28T05:15:02Z\",\"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\":{}},\"f:status\":{\"f:storedVersions\":{}}}}]},\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2021-10-28T05:15:03Z\",\"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-19/job-create.json b/k8s-openapi-tests/test-replays/v1-19/job-create.json index aa38b66fe8..ac7354cf05 100644 --- a/k8s-openapi-tests/test-replays/v1-19/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-19/job-create.json @@ -98,7 +98,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"selfLink\":\"/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job\",\"uid\":\"e61f071a-b7fe-4511-bc27-52e1846a170b\",\"resourceVersion\":\"964\",\"creationTimestamp\":\"2021-10-28T05:15:02Z\",\"deletionTimestamp\":\"2021-10-28T05:15:11Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"e61f071a-b7fe-4511-bc27-52e1846a170b\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2021-10-28T05:15:11Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"Failed\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:failed\":{},\"f:startTime\":{}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"e61f071a-b7fe-4511-bc27-52e1846a170b\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"e61f071a-b7fe-4511-bc27-52e1846a170b\",\"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\"}}},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2021-10-28T05:15:11Z\",\"lastTransitionTime\":\"2021-10-28T05:15:11Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2021-10-28T05:15:02Z\",\"failed\":1}}\n" @@ -106,7 +106,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"selfLink\":\"/api/v1/namespaces/default/pods\",\"resourceVersion\":\"965\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-pvjrz\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-create-job-pvjrz\",\"uid\":\"28391b96-40e6-4c97-adc0-e0c0c55f04e3\",\"resourceVersion\":\"965\",\"creationTimestamp\":\"2021-10-28T05:15:02Z\",\"labels\":{\"controller-uid\":\"e61f071a-b7fe-4511-bc27-52e1846a170b\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}}},\"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\":\"2021-10-28T05:15:11Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.5\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-kw95d\",\"secret\":{\"secretName\":\"default-token-kw95d\",\"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\":\"default-token-kw95d\",\"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.19-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.5\",\"podIPs\":[{\"ip\":\"10.244.0.5\"}],\"startTime\":\"2021-10-28T05:15:02Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2021-10-28T05:15:10Z\",\"finishedAt\":\"2021-10-28T05:15:10Z\",\"containerID\":\"containerd://95a7579f358ca3c56a7a5efbb2231ffbe70dec191ee5c269d636e80026df8273\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a\",\"containerID\":\"containerd://95a7579f358ca3c56a7a5efbb2231ffbe70dec191ee5c269d636e80026df8273\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-19/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-19/patch-deployment.json index 8770d1fc14..87a46bed27 100644 --- a/k8s-openapi-tests/test-replays/v1-19/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-19/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"04dbf54f-fa18-481b-a41a-3aad436199fe\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"selfLink\":\"/api/v1/namespaces/default/pods\",\"resourceVersion\":\"892\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-6vq6k\",\"generateName\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-patch-deployment-74dfc8d469-6vq6k\",\"uid\":\"8b26b3e7-340a-4a74-9a4d-499508f92c82\",\"resourceVersion\":\"877\",\"creationTimestamp\":\"2021-10-28T05:15:02Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"74dfc8d469\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469\",\"uid\":\"581c68b9-2e9d-43e6-9a0e-8be52e81369e\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"581c68b9-2e9d-43e6-9a0e-8be52e81369e\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":\"default-token-kw95d\",\"secret\":{\"secretName\":\"default-token-kw95d\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.6\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-kw95d\",\"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.19-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\":\"2021-10-28T05:15:02Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-857c4f8567-tqft5\",\"generateName\":\"k8s-openapi-tests-patch-deployment-857c4f8567-\",\"namespace\":\"default\",\"selfLink\":\"/api/v1/namespaces/default/pods/k8s-openapi-tests-patch-deployment-857c4f8567-tqft5\",\"uid\":\"43bba6e9-942d-4386-9ecf-cc04320d6167\",\"resourceVersion\":\"891\",\"creationTimestamp\":\"2021-10-28T05:15:02Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"857c4f8567\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-857c4f8567\",\"uid\":\"f87a56d8-91e0-4fe7-b291-aa069b5bb4f9\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"f87a56d8-91e0-4fe7-b291-aa069b5bb4f9\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2021-10-28T05:15:02Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-kw95d\",\"secret\":{\"secretName\":\"default-token-kw95d\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.8\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-kw95d\",\"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.19-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2021-10-28T05:15:02Z\"}],\"hostIP\":\"172.18.0.2\",\"startTime\":\"2021-10-28T05:15:02Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"state\":{\"waiting\":{\"reason\":\"ContainerCreating\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"alpine:3.8\",\"imageID\":\"\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-20/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-20/custom_resource_definition-test.json index 9d3457946a..43aeb986a3 100644 --- a/k8s-openapi-tests/test-replays/v1-20/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-20/custom_resource_definition-test.json @@ -50,7 +50,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"97f06015-ff55-4745-a433-ab44c9eed2b4\"}}\n" @@ -74,7 +74,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"f1c71464-4232-409c-b23e-a5fb623806e2\",\"resourceVersion\":\"678\",\"generation\":1,\"creationTimestamp\":\"2022-01-20T05:01:06Z\",\"deletionTimestamp\":\"2022-01-20T05:01:07Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-01-20T05:01:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:acceptedNames\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:conditions\":{}}}},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-01-20T05:01:06Z\",\"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\":{}},\"f:status\":{\"f:storedVersions\":{}}}}]},\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-01-20T05:01:07Z\",\"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-20/job-create.json b/k8s-openapi-tests/test-replays/v1-20/job-create.json index 0f18c7c06e..5e65b32517 100644 --- a/k8s-openapi-tests/test-replays/v1-20/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-20/job-create.json @@ -90,7 +90,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\",\"resourceVersion\":\"723\",\"creationTimestamp\":\"2022-01-20T05:01:06Z\",\"deletionTimestamp\":\"2022-01-20T05:01:14Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-01-20T05:01:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-01-20T05:01:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"Failed\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:failed\":{},\"f:startTime\":{}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\",\"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\"}}},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-01-20T05:01:14Z\",\"lastTransitionTime\":\"2022-01-20T05:01:14Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-01-20T05:01:06Z\",\"failed\":1}}\n" @@ -98,7 +98,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"723\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-nsbdf\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"e5b86334-fbfa-4779-afa6-4fbe98c427aa\",\"resourceVersion\":\"720\",\"creationTimestamp\":\"2022-01-20T05:01:06Z\",\"labels\":{\"controller-uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-01-20T05:01:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a6c60b35-120f-4bed-94a7-42d7a4aaaa6a\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":\"2022-01-20T05:01:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.5\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-fjqw2\",\"secret\":{\"secretName\":\"default-token-fjqw2\",\"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\":\"default-token-fjqw2\",\"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.20-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\"}],\"hostIP\":\"172.20.0.2\",\"podIP\":\"10.244.0.5\",\"podIPs\":[{\"ip\":\"10.244.0.5\"}],\"startTime\":\"2022-01-20T05:01:06Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-01-20T05:01:13Z\",\"finishedAt\":\"2022-01-20T05:01:13Z\",\"containerID\":\"containerd://c6d0e9ade386d583db459d7fc3472cdc6c313d83c7400d0854cdf93f7bdc004e\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300\",\"containerID\":\"containerd://c6d0e9ade386d583db459d7fc3472cdc6c313d83c7400d0854cdf93f7bdc004e\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-20/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-20/patch-deployment.json index db57bdc0e9..5611dcc3b2 100644 --- a/k8s-openapi-tests/test-replays/v1-20/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-20/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"b1d359cf-1386-45e3-841f-5e059d5de6f8\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"661\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-6rg5s\",\"generateName\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-\",\"namespace\":\"default\",\"uid\":\"064ebdce-2167-40d3-9441-1f34da4ce5d0\",\"resourceVersion\":\"661\",\"creationTimestamp\":\"2022-01-20T05:01:06Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"74dfc8d469\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469\",\"uid\":\"861632b6-a65a-4e7e-a9a0-4dea908dc374\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-01-20T05:01:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"861632b6-a65a-4e7e-a9a0-4dea908dc374\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-01-20T05:01:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"default-token-fjqw2\",\"secret\":{\"secretName\":\"default-token-fjqw2\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.6\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-fjqw2\",\"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.20-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-01-20T05:01:06Z\"}],\"hostIP\":\"172.20.0.2\",\"startTime\":\"2022-01-20T05:01:06Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"state\":{\"waiting\":{\"reason\":\"ContainerCreating\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"alpine:3.6\",\"imageID\":\"\",\"started\":false}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-7bb5d559fd-jnfsw\",\"generateName\":\"k8s-openapi-tests-patch-deployment-7bb5d559fd-\",\"namespace\":\"default\",\"uid\":\"0a44a98e-13ae-449a-9bea-ca37b22f4960\",\"resourceVersion\":\"648\",\"creationTimestamp\":\"2022-01-20T05:01:06Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"7bb5d559fd\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-7bb5d559fd\",\"uid\":\"e006e264-b403-4305-9213-60089d260475\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-01-20T05:01:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"e006e264-b403-4305-9213-60089d260475\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":\"default-token-fjqw2\",\"secret\":{\"secretName\":\"default-token-fjqw2\",\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.7\",\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-fjqw2\",\"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.20-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\":\"2022-01-20T05:01:06Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-21/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-21/custom_resource_definition-test.json index 539de41de7..e378017071 100644 --- a/k8s-openapi-tests/test-replays/v1-21/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-21/custom_resource_definition-test.json @@ -50,7 +50,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"564674b6-ea70-4104-bb7f-b2d9d5087528\"}}\n" @@ -74,7 +74,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"0d120824-f3e5-4bac-9317-090d7038f331\",\"resourceVersion\":\"630\",\"generation\":1,\"creationTimestamp\":\"2022-06-17T07:28:15Z\",\"deletionTimestamp\":\"2022-06-17T07:28:17Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-06-17T07:28:15Z\",\"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\":{}}}}}},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-06-17T07:28:15Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-06-17T07:28:15Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-06-17T07:28:15Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-06-17T07:28:17Z\",\"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-21/job-create.json b/k8s-openapi-tests/test-replays/v1-21/job-create.json index 481ba93723..3fed27f4c0 100644 --- a/k8s-openapi-tests/test-replays/v1-21/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-21/job-create.json @@ -194,7 +194,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\",\"resourceVersion\":\"670\",\"creationTimestamp\":\"2022-06-17T07:28:15Z\",\"deletionTimestamp\":\"2022-06-17T07:28:36Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-06-17T07:28:15Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-06-17T07:28:36Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\",\"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\"}}},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-06-17T07:28:36Z\",\"lastTransitionTime\":\"2022-06-17T07:28:36Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-06-17T07:28:15Z\",\"failed\":1}}\n" @@ -202,7 +202,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"670\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-vdgbq\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"5aba2eb4-3619-4cd3-ae5f-68268ad47e95\",\"resourceVersion\":\"667\",\"creationTimestamp\":\"2022-06-17T07:28:15Z\",\"labels\":{\"controller-uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-06-17T07:28:15Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"8a6b1c05-5a53-4f7e-a022-fe6b8ce06a8d\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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\":\"2022-06-17T07:28:36Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.6\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-q6zhr\",\"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-q6zhr\",\"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.21-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-06-17T07:28:15Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-06-17T07:28:15Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-06-17T07:28:15Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-create-job]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-06-17T07:28:15Z\"}],\"hostIP\":\"172.19.0.2\",\"podIP\":\"10.244.0.6\",\"podIPs\":[{\"ip\":\"10.244.0.6\"}],\"startTime\":\"2022-06-17T07:28:15Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-06-17T07:28:35Z\",\"finishedAt\":\"2022-06-17T07:28:35Z\",\"containerID\":\"containerd://e704af5a5d9cbbceefcc19904dd430e86f75664797735de3c9ab008b0c917f23\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c\",\"containerID\":\"containerd://e704af5a5d9cbbceefcc19904dd430e86f75664797735de3c9ab008b0c917f23\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-21/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-21/patch-deployment.json index 1afdf14d6a..6e0aace7e0 100644 --- a/k8s-openapi-tests/test-replays/v1-21/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-21/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"3bb83b91-d536-49b3-a346-ef65093eef89\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"605\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-kw5g8\",\"generateName\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-\",\"namespace\":\"default\",\"uid\":\"1f76fe0c-5dd6-462a-aa5b-c4ef36243e98\",\"resourceVersion\":\"600\",\"creationTimestamp\":\"2022-06-17T07:28:15Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"74dfc8d469\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469\",\"uid\":\"236f329d-7a77-4f47-b68f-a3ed193f4327\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-06-17T07:28:15Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"236f329d-7a77-4f47-b68f-a3ed193f4327\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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-xdm7p\",\"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-xdm7p\",\"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.21-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\":\"2022-06-17T07:28:15Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-76f96849bd-rw492\",\"generateName\":\"k8s-openapi-tests-patch-deployment-76f96849bd-\",\"namespace\":\"default\",\"uid\":\"5afd83f0-8ba4-4eae-b02c-4aee8b776337\",\"resourceVersion\":\"603\",\"creationTimestamp\":\"2022-06-17T07:28:15Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"76f96849bd\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-76f96849bd\",\"uid\":\"7bb831ab-ce72-4eb2-b37f-96a3e0d07bd5\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-06-17T07:28:15Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"7bb831ab-ce72-4eb2-b37f-96a3e0d07bd5\\\"}\":{\".\":{},\"f:apiVersion\":{},\"f:blockOwnerDeletion\":{},\"f:controller\":{},\"f:kind\":{},\"f:name\":{},\"f:uid\":{}}}},\"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-v4tzq\",\"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.9\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-v4tzq\",\"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\",\"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\",\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-22/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-22/custom_resource_definition-test.json index fdc6e43891..27b9e1cf59 100644 --- a/k8s-openapi-tests/test-replays/v1-22/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-22/custom_resource_definition-test.json @@ -58,7 +58,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"c40c72b0-74c8-4578-90e5-a25070128c78\"}}\n" @@ -82,7 +82,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"fcbcf450-6f43-427c-9677-c08e9faee6a6\",\"resourceVersion\":\"647\",\"generation\":1,\"creationTimestamp\":\"2022-08-17T22:18:41Z\",\"deletionTimestamp\":\"2022-08-17T22:18:44Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-17T22:18:41Z\",\"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\":\"2022-08-17T22:18:41Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:18:41Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:18:41Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:18:44Z\",\"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-22/job-create.json b/k8s-openapi-tests/test-replays/v1-22/job-create.json index 199629cc3a..a0e1d9ed78 100644 --- a/k8s-openapi-tests/test-replays/v1-22/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-22/job-create.json @@ -106,7 +106,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\",\"resourceVersion\":\"680\",\"generation\":2,\"creationTimestamp\":\"2022-08-17T22:18:41Z\",\"deletionTimestamp\":\"2022-08-17T22:18:51Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-17T22:18:41Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-08-17T22:18:51Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\",\"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},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-08-17T22:18:51Z\",\"lastTransitionTime\":\"2022-08-17T22:18:51Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-08-17T22:18:41Z\",\"failed\":1}}\n" @@ -114,7 +114,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"680\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-r526f\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"82191286-6d94-4e4a-9b97-1098052c71e6\",\"resourceVersion\":\"677\",\"creationTimestamp\":\"2022-08-17T22:18:41Z\",\"labels\":{\"controller-uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"a049aa85-3add-45f3-b06b-0e7134e2463a\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-17T22:18:41Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a049aa85-3add-45f3-b06b-0e7134e2463a\\\"}\":{}}},\"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\":\"2022-08-17T22:18:51Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.8\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-dvlm4\",\"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-dvlm4\",\"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.22-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:18:41Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:18:41Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:18:41Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:18:41Z\"}],\"hostIP\":\"172.19.0.2\",\"podIP\":\"10.244.0.8\",\"podIPs\":[{\"ip\":\"10.244.0.8\"}],\"startTime\":\"2022-08-17T22:18:41Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-08-17T22:18:49Z\",\"finishedAt\":\"2022-08-17T22:18:49Z\",\"containerID\":\"containerd://c567b80dc9188aed46ec17cc602cbc2752120f82f4fa2fe54776612b968e452a\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad\",\"containerID\":\"containerd://c567b80dc9188aed46ec17cc602cbc2752120f82f4fa2fe54776612b968e452a\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json index 1af00f6fd2..c9329ee95d 100644 --- a/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"e09773e8-1410-43c8-abb5-5afa4e2d0c96\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"603\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-wv4jx\",\"generateName\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-\",\"namespace\":\"default\",\"uid\":\"237367c6-c6cf-4971-bf0b-a5b803f78bd3\",\"resourceVersion\":\"598\",\"creationTimestamp\":\"2022-08-17T22:18:41Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"74dfc8d469\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469\",\"uid\":\"ea39209e-f471-400f-8aa9-a1b890b12de6\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-17T22:18:41Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"ea39209e-f471-400f-8aa9-a1b890b12de6\\\"}\":{}}},\"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-bnnjz\",\"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-bnnjz\",\"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\",\"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\",\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-23/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-23/custom_resource_definition-test.json index 2c9895dede..6b560e96b2 100644 --- a/k8s-openapi-tests/test-replays/v1-23/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-23/custom_resource_definition-test.json @@ -58,7 +58,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"830777da-178b-4e89-9e5a-a03a49bb0563\"}}\n" @@ -82,7 +82,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"a6fd6098-1462-4575-a026-49e883c67234\",\"resourceVersion\":\"649\",\"generation\":1,\"creationTimestamp\":\"2022-08-17T22:29:10Z\",\"deletionTimestamp\":\"2022-08-17T22:29:13Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-17T22:29:10Z\",\"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\":\"2022-08-17T22:29:10Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:29:10Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:29:10Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-17T22:29:13Z\",\"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-23/job-create.json b/k8s-openapi-tests/test-replays/v1-23/job-create.json index 6aae9e9218..bb96f54a3a 100644 --- a/k8s-openapi-tests/test-replays/v1-23/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-23/job-create.json @@ -90,7 +90,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\",\"resourceVersion\":\"670\",\"generation\":2,\"creationTimestamp\":\"2022-08-17T22:29:10Z\",\"deletionTimestamp\":\"2022-08-17T22:29:18Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-17T22:29:10Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-08-17T22:29:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\",\"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},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-08-17T22:29:18Z\",\"lastTransitionTime\":\"2022-08-17T22:29:18Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-08-17T22:29:10Z\",\"failed\":1}}\n" @@ -98,7 +98,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"670\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-5z2mh\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"f3fc42f9-cc98-4603-b837-7a3416eb7b4e\",\"resourceVersion\":\"667\",\"creationTimestamp\":\"2022-08-17T22:29:10Z\",\"labels\":{\"controller-uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"314a5402-dc26-419b-8556-b5d96ccd45f7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-17T22:29:10Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"314a5402-dc26-419b-8556-b5d96ccd45f7\\\"}\":{}}},\"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\":\"2022-08-17T22:29:18Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.7\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-r4h6x\",\"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-r4h6x\",\"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.23-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:29:10Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:29:10Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:29:10Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-17T22:29:10Z\"}],\"hostIP\":\"172.19.0.2\",\"podIP\":\"10.244.0.7\",\"podIPs\":[{\"ip\":\"10.244.0.7\"}],\"startTime\":\"2022-08-17T22:29:10Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-08-17T22:29:15Z\",\"finishedAt\":\"2022-08-17T22:29:15Z\",\"containerID\":\"containerd://f04975d58a13d70e4f0e51358c2d5db5baad10e4f8addb97523aea9a703cb5f7\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad\",\"containerID\":\"containerd://f04975d58a13d70e4f0e51358c2d5db5baad10e4f8addb97523aea9a703cb5f7\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json index 8b2e533e4a..66ef9b2746 100644 --- a/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"9ca10367-891b-4642-b160-9753f2d9270a\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"616\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-5c6c56699-hcpzh\",\"generateName\":\"k8s-openapi-tests-patch-deployment-5c6c56699-\",\"namespace\":\"default\",\"uid\":\"6402303f-f777-4045-b00e-e2a8edc4af4a\",\"resourceVersion\":\"616\",\"creationTimestamp\":\"2022-08-17T22:29:10Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"5c6c56699\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-5c6c56699\",\"uid\":\"a3bbffd7-6619-4c20-8944-2dc4025098de\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-17T22:29:10Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a3bbffd7-6619-4c20-8944-2dc4025098de\\\"}\":{}}},\"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-b5c7n\",\"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-b5c7n\",\"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\",\"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\",\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-24/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-24/custom_resource_definition-test.json index 1280a01a8a..73592bf8c9 100644 --- a/k8s-openapi-tests/test-replays/v1-24/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-24/custom_resource_definition-test.json @@ -50,7 +50,7 @@ { "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"98bdf826-05fc-4dda-b99b-3b23eec4bf1c\"}}\n" @@ -74,7 +74,7 @@ { "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"ec4d4a8c-891d-43da-a7b8-4010085bc5e9\",\"resourceVersion\":\"546\",\"generation\":1,\"creationTimestamp\":\"2022-08-18T01:30:42Z\",\"deletionTimestamp\":\"2022-08-18T01:30:44Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-18T01:30:42Z\",\"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\":\"2022-08-18T01:30:42Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-18T01:30:42Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-18T01:30:42Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-18T01:30:44Z\",\"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-24/job-create.json b/k8s-openapi-tests/test-replays/v1-24/job-create.json index de1b6ed158..d2ee9e70b8 100644 --- a/k8s-openapi-tests/test-replays/v1-24/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-24/job-create.json @@ -114,7 +114,7 @@ { "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\",\"resourceVersion\":\"583\",\"generation\":2,\"creationTimestamp\":\"2022-08-18T01:30:42Z\",\"deletionTimestamp\":\"2022-08-18T01:30:53Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-18T01:30:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-08-18T01:30:52Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:ready\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\",\"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},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-08-18T01:30:52Z\",\"lastTransitionTime\":\"2022-08-18T01:30:52Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-08-18T01:30:42Z\",\"failed\":1,\"ready\":0}}\n" @@ -122,7 +122,7 @@ { "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"583\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-4jd7q\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"1c396ad3-a4fa-4d7d-9f52-8704600a4ca7\",\"resourceVersion\":\"577\",\"creationTimestamp\":\"2022-08-18T01:30:42Z\",\"labels\":{\"controller-uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"4187e0ee-f431-43d4-b018-e02b6280fb19\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-18T01:30:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"4187e0ee-f431-43d4-b018-e02b6280fb19\\\"}\":{}}},\"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\":\"2022-08-18T01:30:52Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.8\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-gsf2s\",\"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-gsf2s\",\"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.24-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-18T01:30:42Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-18T01:30:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-18T01:30:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-18T01:30:42Z\"}],\"hostIP\":\"172.21.0.2\",\"podIP\":\"10.244.0.8\",\"podIPs\":[{\"ip\":\"10.244.0.8\"}],\"startTime\":\"2022-08-18T01:30:42Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-08-18T01:30:49Z\",\"finishedAt\":\"2022-08-18T01:30:49Z\",\"containerID\":\"containerd://820e07f0f98c22611609a4b5ea6d5bb66f93f70a303da15cd25e182e256c62e6\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad\",\"containerID\":\"containerd://820e07f0f98c22611609a4b5ea6d5bb66f93f70a303da15cd25e182e256c62e6\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json index 78d967569f..f5b295d719 100644 --- a/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json @@ -34,7 +34,7 @@ { "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", - "request_body": "{}", + "request_body": "", "request_content_type": "application/json", "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\":\"0218c2d3-7adc-4628-86cb-c1dbd8f63885\"}}\n" @@ -42,7 +42,7 @@ { "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_body": "", "request_content_type": "application/json", "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"516\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-67d6468fcb-8pcwv\",\"generateName\":\"k8s-openapi-tests-patch-deployment-67d6468fcb-\",\"namespace\":\"default\",\"uid\":\"aeed7ce3-ab62-4a09-82e8-82d5a3d8e7ba\",\"resourceVersion\":\"513\",\"creationTimestamp\":\"2022-08-18T01:30:42Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"67d6468fcb\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-67d6468fcb\",\"uid\":\"bb7cc5b6-ed2d-4296-b548-f8c6c2be3eda\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-18T01:30:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"bb7cc5b6-ed2d-4296-b548-f8c6c2be3eda\\\"}\":{}}},\"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-dcbbv\",\"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.9\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-dcbbv\",\"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\",\"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\",\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-7c98d4f7d9-l762w\",\"generateName\":\"k8s-openapi-tests-patch-deployment-7c98d4f7d9-\",\"namespace\":\"default\",\"uid\":\"fa5f8dc7-7f5e-40e1-91e2-cfdaa1407a97\",\"resourceVersion\":\"508\",\"creationTimestamp\":\"2022-08-18T01:30:42Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"7c98d4f7d9\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-7c98d4f7d9\",\"uid\":\"d6a4018b-a341-4e7f-b8e3-25333e46fce3\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-18T01:30:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"d6a4018b-a341-4e7f-b8e3-25333e46fce3\\\"}\":{}}},\"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-wzhwf\",\"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-wzhwf\",\"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.24-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\":\"2022-08-18T01:30:42Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" diff --git a/k8s-openapi-tests/test-replays/v1-25/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-25/api_versions-list.json new file mode 100644 index 0000000000..b145040d5a --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/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\"},{\"groupVersion\":\"autoscaling/v2beta2\",\"version\":\"v2beta2\"}],\"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\"},{\"groupVersion\":\"storage.k8s.io/v1beta1\",\"version\":\"v1beta1\"}],\"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/v1beta2\",\"version\":\"v1beta2\"},{\"groupVersion\":\"flowcontrol.apiserver.k8s.io/v1beta1\",\"version\":\"v1beta1\"}],\"preferredVersion\":{\"groupVersion\":\"flowcontrol.apiserver.k8s.io/v1beta2\",\"version\":\"v1beta2\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-25/custom_resource_definition-test.json new file mode 100644 index 0000000000..8504cf49ea --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/custom_resource_definition-test.json @@ -0,0 +1,82 @@ +[ + { + "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\"}},\"required\":[\"prop1\",\"prop2\"],\"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\":\"1c5b46d1-48ca-404a-9bc0-c4eec1cf8c6e\",\"resourceVersion\":\"753\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"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\":\"1c5b46d1-48ca-404a-9bc0-c4eec1cf8c6e\",\"resourceVersion\":\"756\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\":\"2022-08-31T19:40:42Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"False\",\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"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]}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2022-08-31T19:40:44Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2022-08-31T19:40:44Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"817\",\"uid\":\"a402a057-c5ea-4cb4-a05c-c3a5d27115dc\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\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\":\"2022-08-31T19:40:44Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2022-08-31T19:40:44Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"817\",\"uid\":\"a402a057-c5ea-4cb4-a05c-c3a5d27115dc\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}],\"kind\":\"FooBarList\",\"metadata\":{\"continue\":\"\",\"resourceVersion\":\"817\"}}\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\":\"2022-08-31T19:40:44Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2022-08-31T19:40:44Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"817\",\"uid\":\"a402a057-c5ea-4cb4-a05c-c3a5d27115dc\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\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\":\"2022-08-31T19:40:44Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2022-08-31T19:40:44Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"817\",\"uid\":\"a402a057-c5ea-4cb4-a05c-c3a5d27115dc\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", + "request_method": "DELETE", + "request_body": "", + "request_content_type": "application/json", + "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\":\"a402a057-c5ea-4cb4-a05c-c3a5d27115dc\"}}\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\"}}", + "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 \\\"fb2\\\" is invalid: spec.prop2: Required value\",\"reason\":\"Invalid\",\"details\":{\"name\":\"fb2\",\"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}}", + "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/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", + "request_method": "DELETE", + "request_body": "", + "request_content_type": "application/json", + "response_status_code": 200, + "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"1c5b46d1-48ca-404a-9bc0-c4eec1cf8c6e\",\"resourceVersion\":\"819\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"deletionTimestamp\":\"2022-08-31T19:40:44Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\":\"2022-08-31T19:40:42Z\",\"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\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-08-31T19:40:44Z\",\"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-25/deployment-list.json b/k8s-openapi-tests/test-replays/v1-25/deployment-list.json new file mode 100644 index 0000000000..0c84b88b55 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/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\":\"755\"},\"items\":[{\"metadata\":{\"name\":\"coredns\",\"namespace\":\"kube-system\",\"uid\":\"a1884540-efe2-4395-827e-bfc7722cad9f\",\"resourceVersion\":\"451\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"k8s-app\":\"kube-dns\"},\"annotations\":{\"deployment.kubernetes.io/revision\":\"1\"},\"managedFields\":[{\"manager\":\"kubeadm\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-08-31T19:36: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\":\"2022-08-31T19:36:30Z\",\"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.9.3\",\"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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"2022-08-31T19:36:29Z\",\"lastTransitionTime\":\"2022-08-31T19:36:29Z\",\"reason\":\"MinimumReplicasAvailable\",\"message\":\"Deployment has minimum availability.\"},{\"type\":\"Progressing\",\"status\":\"True\",\"lastUpdateTime\":\"2022-08-31T19:36:30Z\",\"lastTransitionTime\":\"2022-08-31T19:36:20Z\",\"reason\":\"NewReplicaSetAvailable\",\"message\":\"ReplicaSet \\\"coredns-565d847f94\\\" has successfully progressed.\"}]}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/job-create.json b/k8s-openapi-tests/test-replays/v1-25/job-create.json new file mode 100644 index 0000000000..f21d1fb957 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/job-create.json @@ -0,0 +1,130 @@ +[ + { + "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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"758\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"758\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"780\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"startTime\":\"2022-08-31T19:40:42Z\",\"active\":1,\"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\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"865\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-08-31T19:40:53Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-08-31T19:40:53Z\",\"lastTransitionTime\":\"2022-08-31T19:40:53Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-08-31T19:40:42Z\",\"failed\":1,\"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\":\"867\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-db9jh\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"58ec71ed-7e75-45b9-b6d2-6c44ee81ef1a\",\"resourceVersion\":\"863\",\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"9d457a3f-331b-494c-8fce-c352ba62e803\\\"}\":{}}},\"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\":\"2022-08-31T19:40:53Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.9\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-f9zm2\",\"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-f9zm2\",\"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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.9\",\"podIPs\":[{\"ip\":\"10.244.0.9\"}],\"startTime\":\"2022-08-31T19:40:42Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-08-31T19:40:50Z\",\"finishedAt\":\"2022-08-31T19:40:50Z\",\"containerID\":\"containerd://f9743faf65246585bbc55b02725b6031ed5d83d2eed07e944dd8d0ac0314b7d5\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad\",\"containerID\":\"containerd://f9743faf65246585bbc55b02725b6031ed5d83d2eed07e944dd8d0ac0314b7d5\",\"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": "application/json", + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"resourceVersion\":\"868\",\"generation\":2,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"deletionTimestamp\":\"2022-08-31T19:40:53Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:parallelism\":{},\"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\":\"2022-08-31T19:40:53Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:ready\":{},\"f:startTime\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"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},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2022-08-31T19:40:53Z\",\"lastTransitionTime\":\"2022-08-31T19:40:53Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-08-31T19:40:42Z\",\"failed\":1,\"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": "application/json", + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"868\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-db9jh\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"58ec71ed-7e75-45b9-b6d2-6c44ee81ef1a\",\"resourceVersion\":\"863\",\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"controller-uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"9d457a3f-331b-494c-8fce-c352ba62e803\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"9d457a3f-331b-494c-8fce-c352ba62e803\\\"}\":{}}},\"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\":\"2022-08-31T19:40:53Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.9\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-f9zm2\",\"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-f9zm2\",\"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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.9\",\"podIPs\":[{\"ip\":\"10.244.0.9\"}],\"startTime\":\"2022-08-31T19:40:42Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-08-31T19:40:50Z\",\"finishedAt\":\"2022-08-31T19:40:50Z\",\"containerID\":\"containerd://f9743faf65246585bbc55b02725b6031ed5d83d2eed07e944dd8d0ac0314b7d5\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad\",\"containerID\":\"containerd://f9743faf65246585bbc55b02725b6031ed5d83d2eed07e944dd8d0ac0314b7d5\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/logs-get.json b/k8s-openapi-tests/test-replays/v1-25/logs-get.json new file mode 100644 index 0000000000..67c0ca02a9 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/logs-get.json @@ -0,0 +1,18 @@ +[ + { + "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\":\"757\"},\"items\":[{\"metadata\":{\"name\":\"coredns-565d847f94-fmthl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"a3c9a35d-1a5b-42e7-914a-b9aac8a5cc21\",\"resourceVersion\":\"438\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:29Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.4\\\"}\":{\".\":{},\"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-4m7nz\",\"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.9.3\",\"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-4m7nz\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://402fc57300b00136a29f9f4eacf55dc76e7d1791683a89855c886b2844b2d168\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-565d847f94-w8rrl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"20734902-84c6-46b5-a672-d97306b53dad\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:30Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"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-tv7vh\",\"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.9.3\",\"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-tv7vh\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://0b1ac08eb17f1fa05719821c676262a90552daa921895e5462094d2599fc042c\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"7adce544-f1e6-4c10-868e-bf6057316192\",\"resourceVersion\":\"314\",\"creationTimestamp\":\"2022-08-31T19:36:08Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.18.0.2:2379\",\"kubernetes.io/config.hash\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.mirror\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553371550Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:08Z\",\"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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.4-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.18.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.18.0.2:2380\",\"--initial-cluster=v1.25-control-plane=https://172.18.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.18.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.18.0.2:2380\",\"--name=v1.25-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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:01Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.4-0\",\"imageID\":\"sha256:a8a176a5d5d698f9409dc246f81fa69d37d4a2f4132ba5e62e72a78476b27f66\",\"containerID\":\"containerd://a52dac386a528437b659c11a44fb02f4ed6210dba0149c4e5e3fec6d81892169\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-jzl5d\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"3618c5af-367e-405c-b5aa-827723e55a40\",\"resourceVersion\":\"401\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"6d46db54f9\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"f0990180-3e27-41e1-8bae-2b51fc16be44\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"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\\\":\\\"f0990180-3e27-41e1-8bae-2b51fc16be44\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:23Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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-fkbnf\",\"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:v20220510-4929dd75\",\"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.25-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-fkbnf\",\"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\",\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.25-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:20Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:22Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20220510-4929dd75\",\"imageID\":\"sha256:6fb66cd78abfe9e0735a9a751f2586b7984e0d279e87fa8dd175781de6595627\",\"containerID\":\"containerd://7ce03ed774c69ae47df28888e0915d0beaa0d9bce7340cd14984e6e43225f9fd\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"bf183b7b-04a7-4027-b6f8-5bd05118d970\",\"resourceVersion\":\"304\",\"creationTimestamp\":\"2022-08-31T19:36:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.18.0.2:6443\",\"kubernetes.io/config.hash\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.mirror\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.seen\":\"2022-08-31T19:35:58.859237640Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:12Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.18.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\",\"--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.18.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.18.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.18.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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:5ec0622c68ad511001d934d79445982265e38741d66b0af8b15d1ea8f96fb17f\",\"containerID\":\"containerd://a381f034091840fad0772d29dfe0662514b38fc37aeb5e006aeb6da87b721d84\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"8d4a6e69-98e7-4a29-b1a1-d72114eb268f\",\"resourceVersion\":\"308\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.mirror\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553379355Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:13Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.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.25\",\"--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\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:95a3268939ccb77f4d4c77e2f5a0b13da7e1ec238a7d7bee5db3a3d36f4fedf8\",\"containerID\":\"containerd://4e02ab294df98e2648a06d0d872a3e1a927a1574b0e3938ef507f5e6af020ab4\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-64wbx\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"e61ed188-23be-4ae4-91ef-42ba7b62b40f\",\"resourceVersion\":\"395\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"controller-revision-hash\":\"55c79b8759\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"6a82c942-2f1e-482d-8029-0e2f3da4de6e\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a82c942-2f1e-482d-8029-0e2f3da4de6e\\\"}\":{}}},\"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\":\"2022-08-31T19:36:21Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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-g4m8c\",\"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.25.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-g4m8c\",\"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.25-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:21Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:21Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:20Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:21Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:0f7246f3fc6b4902405af19e0f9a56b8577576acba18299c740aa3e1184995cc\",\"containerID\":\"containerd://f91ea4f665647b43b688666b70fcf87d65582b99145c0728d4d96e291175168a\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"0ca9e501-5a2e-4d66-b572-94e190bfaef1\",\"resourceVersion\":\"313\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.mirror\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553380266Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:f027f069bad40bc19b0ea8bae94bfa503ec87443c5d08d9bcd445e295a730ed2\",\"containerID\":\"containerd://00d4af0937e21bdaa960689e16429f37d1620256400dfdb8f9e7a02e267b5705\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" + }, + { + "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.25-control-plane/log?&container=kube-apiserver", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "I0831 19:36:00.300774 1 server.go:563] external host was not specified, using 172.18.0.2\nI0831 19:36:00.301186 1 server.go:161] Version: v1.25.0\nI0831 19:36:00.301207 1 server.go:163] \"Golang settings\" GOGC=\"\" GOMAXPROCS=\"\" GOTRACEBACK=\"\"\nI0831 19:36:00.923704 1 shared_informer.go:255] Waiting for caches to sync for node_authorizer\nI0831 19:36:00.925072 1 plugins.go:158] Loaded 12 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,RuntimeClass,DefaultIngressClass,MutatingAdmissionWebhook.\nI0831 19:36:00.925088 1 plugins.go:161] Loaded 11 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,CertificateSubjectRestriction,ValidatingAdmissionWebhook,ResourceQuota.\nI0831 19:36:00.926314 1 plugins.go:158] Loaded 12 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,RuntimeClass,DefaultIngressClass,MutatingAdmissionWebhook.\nI0831 19:36:00.926325 1 plugins.go:161] Loaded 11 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,CertificateSubjectRestriction,ValidatingAdmissionWebhook,ResourceQuota.\nW0831 19:36:00.930070 1 logging.go:59] [core] [Channel #1 SubChannel #2] grpc: addrConn.createTransport failed to connect to {\n \"Addr\": \"127.0.0.1:2379\",\n \"ServerName\": \"127.0.0.1\",\n \"Attributes\": null,\n \"BalancerAttributes\": null,\n \"Type\": 0,\n \"Metadata\": null\n}. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\"\nW0831 19:36:02.485994 1 genericapiserver.go:656] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0831 19:36:02.487510 1 instance.go:261] Using reconciler: lease\nI0831 19:36:02.740987 1 instance.go:574] API group \"internal.apiserver.k8s.io\" is not enabled, skipping.\nW0831 19:36:03.211382 1 genericapiserver.go:656] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.212446 1 genericapiserver.go:656] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.215127 1 genericapiserver.go:656] Skipping API autoscaling/v2beta1 because it has no resources.\nW0831 19:36:03.223166 1 genericapiserver.go:656] Skipping API batch/v1beta1 because it has no resources.\nW0831 19:36:03.227348 1 genericapiserver.go:656] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.229896 1 genericapiserver.go:656] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.229951 1 genericapiserver.go:656] Skipping API discovery.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.235818 1 genericapiserver.go:656] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.235833 1 genericapiserver.go:656] Skipping API networking.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.237987 1 genericapiserver.go:656] Skipping API node.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.237999 1 genericapiserver.go:656] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.238051 1 genericapiserver.go:656] Skipping API policy/v1beta1 because it has no resources.\nW0831 19:36:03.244042 1 genericapiserver.go:656] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.244059 1 genericapiserver.go:656] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.246134 1 genericapiserver.go:656] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.246147 1 genericapiserver.go:656] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.252105 1 genericapiserver.go:656] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.257671 1 genericapiserver.go:656] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW0831 19:36:03.263265 1 genericapiserver.go:656] Skipping API apps/v1beta2 because it has no resources.\nW0831 19:36:03.263279 1 genericapiserver.go:656] Skipping API apps/v1beta1 because it has no resources.\nW0831 19:36:03.265743 1 genericapiserver.go:656] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nW0831 19:36:03.267739 1 genericapiserver.go:656] Skipping API events.k8s.io/v1beta1 because it has no resources.\nI0831 19:36:03.268886 1 plugins.go:158] Loaded 12 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,RuntimeClass,DefaultIngressClass,MutatingAdmissionWebhook.\nI0831 19:36:03.268901 1 plugins.go:161] Loaded 11 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,CertificateSubjectRestriction,ValidatingAdmissionWebhook,ResourceQuota.\nW0831 19:36:03.297740 1 genericapiserver.go:656] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0831 19:36:04.444156 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0831 19:36:04.444197 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0831 19:36:04.444291 1 secure_serving.go:210] Serving securely on [::]:6443\nI0831 19:36:04.444333 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0831 19:36:04.444460 1 controller.go:83] Starting OpenAPI AggregationController\nI0831 19:36:04.444566 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"aggregator-proxy-cert::/etc/kubernetes/pki/front-proxy-client.crt::/etc/kubernetes/pki/front-proxy-client.key\"\nI0831 19:36:04.444774 1 available_controller.go:491] Starting AvailableConditionController\nI0831 19:36:04.444786 1 apf_controller.go:300] Starting API Priority and Fairness config controller\nI0831 19:36:04.444789 1 cache.go:32] Waiting for caches to sync for AvailableConditionController controller\nI0831 19:36:04.444801 1 autoregister_controller.go:141] Starting autoregister controller\nI0831 19:36:04.445539 1 cache.go:32] Waiting for caches to sync for autoregister controller\nI0831 19:36:04.445617 1 controller.go:80] Starting OpenAPI V3 AggregationController\nI0831 19:36:04.445730 1 controller.go:85] Starting OpenAPI controller\nI0831 19:36:04.446641 1 customresource_discovery_controller.go:209] Starting DiscoveryController\nI0831 19:36:04.446858 1 naming_controller.go:291] Starting NamingConditionController\nI0831 19:36:04.446952 1 establishing_controller.go:76] Starting EstablishingController\nI0831 19:36:04.447183 1 controller.go:85] Starting OpenAPI V3 controller\nI0831 19:36:04.447301 1 apiapproval_controller.go:186] Starting KubernetesAPIApprovalPolicyConformantConditionController\nI0831 19:36:04.447463 1 nonstructuralschema_controller.go:192] Starting NonStructuralSchemaConditionController\nI0831 19:36:04.447544 1 crd_finalizer.go:266] Starting CRDFinalizer\nI0831 19:36:04.447732 1 crdregistration_controller.go:111] Starting crd-autoregister controller\nI0831 " + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json new file mode 100644 index 0000000000..379b846d3d --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/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\":\"a5adf0f4-50f7-48c6-bc42-638c73c553f0\",\"resourceVersion\":\"754\",\"generation\":1,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\":\"a5adf0f4-50f7-48c6-bc42-638c73c553f0\",\"resourceVersion\":\"759\",\"generation\":2,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\":\"a5adf0f4-50f7-48c6-bc42-638c73c553f0\",\"resourceVersion\":\"763\",\"generation\":3,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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\":\"a5adf0f4-50f7-48c6-bc42-638c73c553f0\",\"resourceVersion\":\"775\",\"generation\":4,\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-08-31T19:40:42Z\",\"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": "application/json", + "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\":\"a5adf0f4-50f7-48c6-bc42-638c73c553f0\"}}\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": "application/json", + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"787\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-696d8f74f9-dxsm5\",\"generateName\":\"k8s-openapi-tests-patch-deployment-696d8f74f9-\",\"namespace\":\"default\",\"uid\":\"867adfcd-a93f-4c61-a32a-a6b9ad326c5b\",\"resourceVersion\":\"772\",\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"696d8f74f9\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-696d8f74f9\",\"uid\":\"d415a20d-af3c-4b26-a27c-930a1f476bb5\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"d415a20d-af3c-4b26-a27c-930a1f476bb5\\\"}\":{}}},\"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-v4mjl\",\"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.7\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-v4mjl\",\"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.25-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\":\"2022-08-31T19:40:42Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-944897db-k5n6h\",\"generateName\":\"k8s-openapi-tests-patch-deployment-944897db-\",\"namespace\":\"default\",\"uid\":\"ba43ebf2-15cc-4994-9f5d-420321601366\",\"resourceVersion\":\"782\",\"creationTimestamp\":\"2022-08-31T19:40:42Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"944897db\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-944897db\",\"uid\":\"2727cd50-a274-4b6b-9d7b-00190657d437\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"2727cd50-a274-4b6b-9d7b-00190657d437\\\"}\":{}}},\"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\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:40:42Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-k8djf\",\"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-k8djf\",\"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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:40:42Z\"}],\"hostIP\":\"172.18.0.2\",\"startTime\":\"2022-08-31T19:40:42Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"state\":{\"waiting\":{\"reason\":\"ContainerCreating\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"alpine:3.6\",\"imageID\":\"\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/pod-list.json b/k8s-openapi-tests/test-replays/v1-25/pod-list.json new file mode 100644 index 0000000000..e3386b8ac0 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/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\":\"753\"},\"items\":[{\"metadata\":{\"name\":\"coredns-565d847f94-fmthl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"a3c9a35d-1a5b-42e7-914a-b9aac8a5cc21\",\"resourceVersion\":\"438\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:29Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.4\\\"}\":{\".\":{},\"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-4m7nz\",\"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.9.3\",\"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-4m7nz\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://402fc57300b00136a29f9f4eacf55dc76e7d1791683a89855c886b2844b2d168\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-565d847f94-w8rrl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"20734902-84c6-46b5-a672-d97306b53dad\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:30Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"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-tv7vh\",\"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.9.3\",\"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-tv7vh\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://0b1ac08eb17f1fa05719821c676262a90552daa921895e5462094d2599fc042c\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"7adce544-f1e6-4c10-868e-bf6057316192\",\"resourceVersion\":\"314\",\"creationTimestamp\":\"2022-08-31T19:36:08Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.18.0.2:2379\",\"kubernetes.io/config.hash\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.mirror\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553371550Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:08Z\",\"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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.4-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.18.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.18.0.2:2380\",\"--initial-cluster=v1.25-control-plane=https://172.18.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.18.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.18.0.2:2380\",\"--name=v1.25-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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:01Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.4-0\",\"imageID\":\"sha256:a8a176a5d5d698f9409dc246f81fa69d37d4a2f4132ba5e62e72a78476b27f66\",\"containerID\":\"containerd://a52dac386a528437b659c11a44fb02f4ed6210dba0149c4e5e3fec6d81892169\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-jzl5d\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"3618c5af-367e-405c-b5aa-827723e55a40\",\"resourceVersion\":\"401\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"6d46db54f9\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"f0990180-3e27-41e1-8bae-2b51fc16be44\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"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\\\":\\\"f0990180-3e27-41e1-8bae-2b51fc16be44\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:23Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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-fkbnf\",\"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:v20220510-4929dd75\",\"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.25-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-fkbnf\",\"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\",\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.25-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:20Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:22Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20220510-4929dd75\",\"imageID\":\"sha256:6fb66cd78abfe9e0735a9a751f2586b7984e0d279e87fa8dd175781de6595627\",\"containerID\":\"containerd://7ce03ed774c69ae47df28888e0915d0beaa0d9bce7340cd14984e6e43225f9fd\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"bf183b7b-04a7-4027-b6f8-5bd05118d970\",\"resourceVersion\":\"304\",\"creationTimestamp\":\"2022-08-31T19:36:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.18.0.2:6443\",\"kubernetes.io/config.hash\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.mirror\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.seen\":\"2022-08-31T19:35:58.859237640Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:12Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.18.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\",\"--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.18.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.18.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.18.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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:5ec0622c68ad511001d934d79445982265e38741d66b0af8b15d1ea8f96fb17f\",\"containerID\":\"containerd://a381f034091840fad0772d29dfe0662514b38fc37aeb5e006aeb6da87b721d84\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"8d4a6e69-98e7-4a29-b1a1-d72114eb268f\",\"resourceVersion\":\"308\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.mirror\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553379355Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:13Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.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.25\",\"--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\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:95a3268939ccb77f4d4c77e2f5a0b13da7e1ec238a7d7bee5db3a3d36f4fedf8\",\"containerID\":\"containerd://4e02ab294df98e2648a06d0d872a3e1a927a1574b0e3938ef507f5e6af020ab4\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-64wbx\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"e61ed188-23be-4ae4-91ef-42ba7b62b40f\",\"resourceVersion\":\"395\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"controller-revision-hash\":\"55c79b8759\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"6a82c942-2f1e-482d-8029-0e2f3da4de6e\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a82c942-2f1e-482d-8029-0e2f3da4de6e\\\"}\":{}}},\"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\":\"2022-08-31T19:36:21Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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-g4m8c\",\"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.25.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-g4m8c\",\"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.25-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:21Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:21Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:20Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:21Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:0f7246f3fc6b4902405af19e0f9a56b8577576acba18299c740aa3e1184995cc\",\"containerID\":\"containerd://f91ea4f665647b43b688666b70fcf87d65582b99145c0728d4d96e291175168a\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"0ca9e501-5a2e-4d66-b572-94e190bfaef1\",\"resourceVersion\":\"313\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.mirror\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553380266Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:f027f069bad40bc19b0ea8bae94bfa503ec87443c5d08d9bcd445e295a730ed2\",\"containerID\":\"containerd://00d4af0937e21bdaa960689e16429f37d1620256400dfdb8f9e7a02e267b5705\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-25/watch_event-watch_pods.json b/k8s-openapi-tests/test-replays/v1-25/watch_event-watch_pods.json new file mode 100644 index 0000000000..6395f89d59 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-25/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\":\"kindnet-jzl5d\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"3618c5af-367e-405c-b5aa-827723e55a40\",\"resourceVersion\":\"401\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"6d46db54f9\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"f0990180-3e27-41e1-8bae-2b51fc16be44\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"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\\\":\\\"f0990180-3e27-41e1-8bae-2b51fc16be44\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:23Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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-fkbnf\",\"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:v20220510-4929dd75\",\"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.25-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-fkbnf\",\"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\",\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.25-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:20Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:20Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:22Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20220510-4929dd75\",\"imageID\":\"sha256:6fb66cd78abfe9e0735a9a751f2586b7984e0d279e87fa8dd175781de6595627\",\"containerID\":\"containerd://7ce03ed774c69ae47df28888e0915d0beaa0d9bce7340cd14984e6e43225f9fd\",\"started\":true}],\"qosClass\":\"Guaranteed\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-controller-manager-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"8d4a6e69-98e7-4a29-b1a1-d72114eb268f\",\"resourceVersion\":\"308\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.mirror\":\"88c812aa287b49296c6afd89052c01b0\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553379355Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:13Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.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.25\",\"--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\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:95a3268939ccb77f4d4c77e2f5a0b13da7e1ec238a7d7bee5db3a3d36f4fedf8\",\"containerID\":\"containerd://4e02ab294df98e2648a06d0d872a3e1a927a1574b0e3938ef507f5e6af020ab4\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-scheduler-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"0ca9e501-5a2e-4d66-b572-94e190bfaef1\",\"resourceVersion\":\"313\",\"creationTimestamp\":\"2022-08-31T19:36:07Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.mirror\":\"f6b226528ab6befa9a264c659e5708da\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553380266Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:f027f069bad40bc19b0ea8bae94bfa503ec87443c5d08d9bcd445e295a730ed2\",\"containerID\":\"containerd://00d4af0937e21bdaa960689e16429f37d1620256400dfdb8f9e7a02e267b5705\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"etcd-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"7adce544-f1e6-4c10-868e-bf6057316192\",\"resourceVersion\":\"314\",\"creationTimestamp\":\"2022-08-31T19:36:08Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.18.0.2:2379\",\"kubernetes.io/config.hash\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.mirror\":\"6db7aa77915b5cdb1128b068c71d0757\",\"kubernetes.io/config.seen\":\"2022-08-31T19:36:07.553371550Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:08Z\",\"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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:15Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.4-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.18.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.18.0.2:2380\",\"--initial-cluster=v1.25-control-plane=https://172.18.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.18.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.18.0.2:2380\",\"--name=v1.25-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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:07Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:01Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.4-0\",\"imageID\":\"sha256:a8a176a5d5d698f9409dc246f81fa69d37d4a2f4132ba5e62e72a78476b27f66\",\"containerID\":\"containerd://a52dac386a528437b659c11a44fb02f4ed6210dba0149c4e5e3fec6d81892169\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-565d847f94-w8rrl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"20734902-84c6-46b5-a672-d97306b53dad\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:30Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"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-tv7vh\",\"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.9.3\",\"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-tv7vh\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://0b1ac08eb17f1fa05719821c676262a90552daa921895e5462094d2599fc042c\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-565d847f94-fmthl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"a3c9a35d-1a5b-42e7-914a-b9aac8a5cc21\",\"resourceVersion\":\"438\",\"creationTimestamp\":\"2022-08-31T19:36:20Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"1694a373-39ef-44ed-a557-1806c6fc89e7\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36:20Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"1694a373-39ef-44ed-a557-1806c6fc89e7\\\"}\":{}}},\"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\":\"2022-08-31T19:36:20Z\",\"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\":\"2022-08-31T19:36:29Z\",\"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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.4\\\"}\":{\".\":{},\"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-4m7nz\",\"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.9.3\",\"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-4m7nz\",\"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.25-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/master\",\"effect\":\"NoSchedule\"},{\"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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:28Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2022-08-31T19:36:28Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://402fc57300b00136a29f9f4eacf55dc76e7d1791683a89855c886b2844b2d168\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-apiserver-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"bf183b7b-04a7-4027-b6f8-5bd05118d970\",\"resourceVersion\":\"304\",\"creationTimestamp\":\"2022-08-31T19:36:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.18.0.2:6443\",\"kubernetes.io/config.hash\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.mirror\":\"48a1b3fc87fe32e67fb1247bc011e3ad\",\"kubernetes.io/config.seen\":\"2022-08-31T19:35:58.859237640Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-08-31T19:36: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\\\":\\\"2df710b4-a4ef-41bf-9a53-3b8836f44a2a\\\"}\":{}}},\"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: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\":\"2022-08-31T19:36:12Z\",\"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\\\":\\\"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:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.18.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.25.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.18.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\",\"--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.18.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.18.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.18.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.25-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\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:11Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-08-31T19:36:08Z\"}],\"hostIP\":\"172.18.0.2\",\"podIP\":\"172.18.0.2\",\"podIPs\":[{\"ip\":\"172.18.0.2\"}],\"startTime\":\"2022-08-31T19:36:08Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2022-08-31T19:36:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.25.0\",\"imageID\":\"docker.io/library/import-2022-08-24@sha256:5ec0622c68ad511001d934d79445982265e38741d66b0af8b15d1ea8f96fb17f\",\"containerID\":\"containerd://a381f034091840fad0772d29dfe0662514b38fc37aeb5e006aeb6da87b721d84\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n" + } +] diff --git a/src/lib.rs b/src/lib.rs index e599f8ffed..c3a794c301 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,7 @@ #![cfg_attr(k8s_openapi_enabled_version="1.22", doc = "v1_22")] #![cfg_attr(k8s_openapi_enabled_version="1.23", doc = "v1_23")] #![cfg_attr(k8s_openapi_enabled_version="1.24", doc = "v1_24")] +#![cfg_attr(k8s_openapi_enabled_version="1.25", doc = "v1_25")] //! ` feature enabled. To see docs for one of the other supported versions, please generate the docs locally with `cargo doc --features 'v1_<>'` //! @@ -728,4 +729,7 @@ pub mod percent_encoding2 { #[cfg(k8s_openapi_enabled_version="1.24")] mod v1_24; #[cfg(k8s_openapi_enabled_version="1.24")] pub use self::v1_24::*; +#[cfg(k8s_openapi_enabled_version="1.25")] mod v1_25; +#[cfg(k8s_openapi_enabled_version="1.25")] pub use self::v1_25::*; + include!(concat!(env!("OUT_DIR"), "/conditional_compilation_macros.rs")); diff --git a/src/v1_18/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_18/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_18/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_18/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_18/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_18/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_18/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs b/src/v1_18/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs index bc3a1b3102..775b511d0d 100644 --- a/src/v1_18/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs +++ b/src/v1_18/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/admissionregistration/v1beta1/validating_webhook_configuration.rs b/src/v1_18/api/admissionregistration/v1beta1/validating_webhook_configuration.rs index 9e878e7d68..5caa78900d 100644 --- a/src/v1_18/api/admissionregistration/v1beta1/validating_webhook_configuration.rs +++ b/src/v1_18/api/admissionregistration/v1beta1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/apps/v1/controller_revision.rs b/src/v1_18/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_18/api/apps/v1/controller_revision.rs +++ b/src/v1_18/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/apps/v1/daemon_set.rs b/src/v1_18/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_18/api/apps/v1/daemon_set.rs +++ b/src/v1_18/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/apps/v1/deployment.rs b/src/v1_18/api/apps/v1/deployment.rs index 5e44b8da7d..afb773717a 100644 --- a/src/v1_18/api/apps/v1/deployment.rs +++ b/src/v1_18/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/apps/v1/replica_set.rs b/src/v1_18/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_18/api/apps/v1/replica_set.rs +++ b/src/v1_18/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/apps/v1/stateful_set.rs b/src/v1_18/api/apps/v1/stateful_set.rs index 6f07e30f3d..3495524cd3 100644 --- a/src/v1_18/api/apps/v1/stateful_set.rs +++ b/src/v1_18/api/apps/v1/stateful_set.rs @@ -92,7 +92,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -133,7 +138,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/auditregistration/v1alpha1/audit_sink.rs b/src/v1_18/api/auditregistration/v1alpha1/audit_sink.rs index 5e04854573..be46207d10 100644 --- a/src/v1_18/api/auditregistration/v1alpha1/audit_sink.rs +++ b/src/v1_18/api/auditregistration/v1alpha1/audit_sink.rs @@ -71,7 +71,12 @@ impl AuditSink { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -107,7 +112,12 @@ impl AuditSink { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_18/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_18/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_18/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_18/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_18/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_18/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_18/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_18/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_18/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/batch/v1/job.rs b/src/v1_18/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_18/api/batch/v1/job.rs +++ b/src/v1_18/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/batch/v1beta1/cron_job.rs b/src/v1_18/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_18/api/batch/v1beta1/cron_job.rs +++ b/src/v1_18/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/batch/v2alpha1/cron_job.rs b/src/v1_18/api/batch/v2alpha1/cron_job.rs index f9f5230a3d..6e6ff4e9f6 100644 --- a/src/v1_18/api/batch/v2alpha1/cron_job.rs +++ b/src/v1_18/api/batch/v2alpha1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/certificates/v1beta1/certificate_signing_request.rs b/src/v1_18/api/certificates/v1beta1/certificate_signing_request.rs index c1c2bffe94..6956b76949 100644 --- a/src/v1_18/api/certificates/v1beta1/certificate_signing_request.rs +++ b/src/v1_18/api/certificates/v1beta1/certificate_signing_request.rs @@ -74,7 +74,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/coordination/v1/lease.rs b/src/v1_18/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_18/api/coordination/v1/lease.rs +++ b/src/v1_18/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/coordination/v1beta1/lease.rs b/src/v1_18/api/coordination/v1beta1/lease.rs index a8267dfd8a..263fc67135 100644 --- a/src/v1_18/api/coordination/v1beta1/lease.rs +++ b/src/v1_18/api/coordination/v1beta1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/config_map.rs b/src/v1_18/api/core/v1/config_map.rs index 57d301f00c..d87f08e8a1 100644 --- a/src/v1_18/api/core/v1/config_map.rs +++ b/src/v1_18/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/endpoints.rs b/src/v1_18/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_18/api/core/v1/endpoints.rs +++ b/src/v1_18/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/event.rs b/src/v1_18/api/core/v1/event.rs index 49d2c275bd..a4d6d8ffc4 100644 --- a/src/v1_18/api/core/v1/event.rs +++ b/src/v1_18/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/limit_range.rs b/src/v1_18/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_18/api/core/v1/limit_range.rs +++ b/src/v1_18/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/namespace.rs b/src/v1_18/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_18/api/core/v1/namespace.rs +++ b/src/v1_18/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/node.rs b/src/v1_18/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_18/api/core/v1/node.rs +++ b/src/v1_18/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/persistent_volume.rs b/src/v1_18/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_18/api/core/v1/persistent_volume.rs +++ b/src/v1_18/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/persistent_volume_claim.rs b/src/v1_18/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_18/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_18/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/pod.rs b/src/v1_18/api/core/v1/pod.rs index 3c3be1bc29..9e0c30f83d 100644 --- a/src/v1_18/api/core/v1/pod.rs +++ b/src/v1_18/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/pod_template.rs b/src/v1_18/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_18/api/core/v1/pod_template.rs +++ b/src/v1_18/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/replication_controller.rs b/src/v1_18/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_18/api/core/v1/replication_controller.rs +++ b/src/v1_18/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/resource_quota.rs b/src/v1_18/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_18/api/core/v1/resource_quota.rs +++ b/src/v1_18/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/secret.rs b/src/v1_18/api/core/v1/secret.rs index ede2b8962d..dfed77fcbd 100644 --- a/src/v1_18/api/core/v1/secret.rs +++ b/src/v1_18/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/service.rs b/src/v1_18/api/core/v1/service.rs index 3bf7eb77a5..f21ba2eadd 100644 --- a/src/v1_18/api/core/v1/service.rs +++ b/src/v1_18/api/core/v1/service.rs @@ -628,7 +628,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/core/v1/service_account.rs b/src/v1_18/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_18/api/core/v1/service_account.rs +++ b/src/v1_18/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_18/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_18/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_18/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/events/v1beta1/event.rs b/src/v1_18/api/events/v1beta1/event.rs index 5f99401f41..b91e83fb26 100644 --- a/src/v1_18/api/events/v1beta1/event.rs +++ b/src/v1_18/api/events/v1beta1/event.rs @@ -125,7 +125,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -166,7 +171,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/extensions/v1beta1/ingress.rs b/src/v1_18/api/extensions/v1beta1/ingress.rs index 81ae86103e..d5a813c0e0 100644 --- a/src/v1_18/api/extensions/v1beta1/ingress.rs +++ b/src/v1_18/api/extensions/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/flowcontrol/v1alpha1/flow_schema.rs b/src/v1_18/api/flowcontrol/v1alpha1/flow_schema.rs index bfc4411eb5..4ebde1a176 100644 --- a/src/v1_18/api/flowcontrol/v1alpha1/flow_schema.rs +++ b/src/v1_18/api/flowcontrol/v1alpha1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/flowcontrol/v1alpha1/priority_level_configuration.rs b/src/v1_18/api/flowcontrol/v1alpha1/priority_level_configuration.rs index 0a27eca70c..1b8ef49468 100644 --- a/src/v1_18/api/flowcontrol/v1alpha1/priority_level_configuration.rs +++ b/src/v1_18/api/flowcontrol/v1alpha1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/networking/v1/network_policy.rs b/src/v1_18/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_18/api/networking/v1/network_policy.rs +++ b/src/v1_18/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/networking/v1beta1/ingress.rs b/src/v1_18/api/networking/v1beta1/ingress.rs index 5710a2d555..60111b9df9 100644 --- a/src/v1_18/api/networking/v1beta1/ingress.rs +++ b/src/v1_18/api/networking/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/networking/v1beta1/ingress_class.rs b/src/v1_18/api/networking/v1beta1/ingress_class.rs index db2ed867ac..5be215bb48 100644 --- a/src/v1_18/api/networking/v1beta1/ingress_class.rs +++ b/src/v1_18/api/networking/v1beta1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/node/v1alpha1/runtime_class.rs b/src/v1_18/api/node/v1alpha1/runtime_class.rs index 5d6a98a995..df1df669f8 100644 --- a/src/v1_18/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_18/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/node/v1beta1/runtime_class.rs b/src/v1_18/api/node/v1beta1/runtime_class.rs index c7d14c2844..96bd8d1022 100644 --- a/src/v1_18/api/node/v1beta1/runtime_class.rs +++ b/src/v1_18/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_18/api/policy/v1beta1/pod_disruption_budget.rs index 0309cc15b7..cfbc071cf0 100644 --- a/src/v1_18/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_18/api/policy/v1beta1/pod_disruption_budget.rs @@ -89,7 +89,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -130,7 +135,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/policy/v1beta1/pod_security_policy.rs b/src/v1_18/api/policy/v1beta1/pod_security_policy.rs index 9d52e6c4da..69efd50636 100644 --- a/src/v1_18/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_18/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1/cluster_role.rs b/src/v1_18/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_18/api/rbac/v1/cluster_role.rs +++ b/src/v1_18/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1/cluster_role_binding.rs b/src/v1_18/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_18/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_18/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1/role.rs b/src/v1_18/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_18/api/rbac/v1/role.rs +++ b/src/v1_18/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1/role_binding.rs b/src/v1_18/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_18/api/rbac/v1/role_binding.rs +++ b/src/v1_18/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1alpha1/cluster_role.rs b/src/v1_18/api/rbac/v1alpha1/cluster_role.rs index a5a559076f..2da53cbdda 100644 --- a/src/v1_18/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_18/api/rbac/v1alpha1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1alpha1/cluster_role_binding.rs b/src/v1_18/api/rbac/v1alpha1/cluster_role_binding.rs index 4d4acff732..c11ee8f38b 100644 --- a/src/v1_18/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_18/api/rbac/v1alpha1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1alpha1/role.rs b/src/v1_18/api/rbac/v1alpha1/role.rs index f1ff1d139f..09215e84ac 100644 --- a/src/v1_18/api/rbac/v1alpha1/role.rs +++ b/src/v1_18/api/rbac/v1alpha1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1alpha1/role_binding.rs b/src/v1_18/api/rbac/v1alpha1/role_binding.rs index 631a88e8b3..0eab6ac84f 100644 --- a/src/v1_18/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_18/api/rbac/v1alpha1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1beta1/cluster_role.rs b/src/v1_18/api/rbac/v1beta1/cluster_role.rs index a3270f86ac..d95356f3de 100644 --- a/src/v1_18/api/rbac/v1beta1/cluster_role.rs +++ b/src/v1_18/api/rbac/v1beta1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1beta1/cluster_role_binding.rs b/src/v1_18/api/rbac/v1beta1/cluster_role_binding.rs index 11753f727d..24f04b80c5 100644 --- a/src/v1_18/api/rbac/v1beta1/cluster_role_binding.rs +++ b/src/v1_18/api/rbac/v1beta1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1beta1/role.rs b/src/v1_18/api/rbac/v1beta1/role.rs index 7936d3528c..6dbb3342f1 100644 --- a/src/v1_18/api/rbac/v1beta1/role.rs +++ b/src/v1_18/api/rbac/v1beta1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/rbac/v1beta1/role_binding.rs b/src/v1_18/api/rbac/v1beta1/role_binding.rs index 850c6dc933..9270734b92 100644 --- a/src/v1_18/api/rbac/v1beta1/role_binding.rs +++ b/src/v1_18/api/rbac/v1beta1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/scheduling/v1/priority_class.rs b/src/v1_18/api/scheduling/v1/priority_class.rs index 2f93d208f8..e54b9e5cb4 100644 --- a/src/v1_18/api/scheduling/v1/priority_class.rs +++ b/src/v1_18/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/scheduling/v1alpha1/priority_class.rs b/src/v1_18/api/scheduling/v1alpha1/priority_class.rs index 776e9d2d84..df91f866d0 100644 --- a/src/v1_18/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_18/api/scheduling/v1alpha1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/scheduling/v1beta1/priority_class.rs b/src/v1_18/api/scheduling/v1beta1/priority_class.rs index c16655b5a3..812a2881cc 100644 --- a/src/v1_18/api/scheduling/v1beta1/priority_class.rs +++ b/src/v1_18/api/scheduling/v1beta1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/settings/v1alpha1/pod_preset.rs b/src/v1_18/api/settings/v1alpha1/pod_preset.rs index 98df3ed558..5b28406b53 100644 --- a/src/v1_18/api/settings/v1alpha1/pod_preset.rs +++ b/src/v1_18/api/settings/v1alpha1/pod_preset.rs @@ -85,7 +85,12 @@ impl PodPreset { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -126,7 +131,12 @@ impl PodPreset { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1/csi_driver.rs b/src/v1_18/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_18/api/storage/v1/csi_driver.rs +++ b/src/v1_18/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1/csi_node.rs b/src/v1_18/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_18/api/storage/v1/csi_node.rs +++ b/src/v1_18/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1/storage_class.rs b/src/v1_18/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_18/api/storage/v1/storage_class.rs +++ b/src/v1_18/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1/volume_attachment.rs b/src/v1_18/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_18/api/storage/v1/volume_attachment.rs +++ b/src/v1_18/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1alpha1/volume_attachment.rs b/src/v1_18/api/storage/v1alpha1/volume_attachment.rs index 8d5275dd55..650e9a415f 100644 --- a/src/v1_18/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_18/api/storage/v1alpha1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1beta1/csi_driver.rs b/src/v1_18/api/storage/v1beta1/csi_driver.rs index 0eeca077ce..ff6e91deb5 100644 --- a/src/v1_18/api/storage/v1beta1/csi_driver.rs +++ b/src/v1_18/api/storage/v1beta1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1beta1/csi_node.rs b/src/v1_18/api/storage/v1beta1/csi_node.rs index 9b686d522d..24267a2e78 100644 --- a/src/v1_18/api/storage/v1beta1/csi_node.rs +++ b/src/v1_18/api/storage/v1beta1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1beta1/storage_class.rs b/src/v1_18/api/storage/v1beta1/storage_class.rs index e78b43c320..d8e2c027b2 100644 --- a/src/v1_18/api/storage/v1beta1/storage_class.rs +++ b/src/v1_18/api/storage/v1beta1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/api/storage/v1beta1/volume_attachment.rs b/src/v1_18/api/storage/v1beta1/volume_attachment.rs index ef7bb87db5..92ca144edc 100644 --- a/src/v1_18/api/storage/v1beta1/volume_attachment.rs +++ b/src/v1_18/api/storage/v1beta1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 45119e8bb5..56d6f38d96 100644 --- a/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs b/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs index 65482e8df5..d49c3de710 100644 --- a/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs +++ b/src/v1_18/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 2b23f77f14..0f9b7b9c11 100644 --- a/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs b/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs index a2c933efa8..14feb9453e 100644 --- a/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs +++ b/src/v1_18/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_19/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_19/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_19/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_19/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_19/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_19/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs b/src/v1_19/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs index bc3a1b3102..775b511d0d 100644 --- a/src/v1_19/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs +++ b/src/v1_19/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/admissionregistration/v1beta1/validating_webhook_configuration.rs b/src/v1_19/api/admissionregistration/v1beta1/validating_webhook_configuration.rs index 9e878e7d68..5caa78900d 100644 --- a/src/v1_19/api/admissionregistration/v1beta1/validating_webhook_configuration.rs +++ b/src/v1_19/api/admissionregistration/v1beta1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/apps/v1/controller_revision.rs b/src/v1_19/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_19/api/apps/v1/controller_revision.rs +++ b/src/v1_19/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/apps/v1/daemon_set.rs b/src/v1_19/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_19/api/apps/v1/daemon_set.rs +++ b/src/v1_19/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/apps/v1/deployment.rs b/src/v1_19/api/apps/v1/deployment.rs index 5e44b8da7d..afb773717a 100644 --- a/src/v1_19/api/apps/v1/deployment.rs +++ b/src/v1_19/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/apps/v1/replica_set.rs b/src/v1_19/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_19/api/apps/v1/replica_set.rs +++ b/src/v1_19/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/apps/v1/stateful_set.rs b/src/v1_19/api/apps/v1/stateful_set.rs index 6f07e30f3d..3495524cd3 100644 --- a/src/v1_19/api/apps/v1/stateful_set.rs +++ b/src/v1_19/api/apps/v1/stateful_set.rs @@ -92,7 +92,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -133,7 +138,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_19/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_19/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_19/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_19/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_19/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_19/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_19/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_19/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_19/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/batch/v1/job.rs b/src/v1_19/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_19/api/batch/v1/job.rs +++ b/src/v1_19/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/batch/v1beta1/cron_job.rs b/src/v1_19/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_19/api/batch/v1beta1/cron_job.rs +++ b/src/v1_19/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/batch/v2alpha1/cron_job.rs b/src/v1_19/api/batch/v2alpha1/cron_job.rs index f9f5230a3d..6e6ff4e9f6 100644 --- a/src/v1_19/api/batch/v2alpha1/cron_job.rs +++ b/src/v1_19/api/batch/v2alpha1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/certificates/v1/certificate_signing_request.rs b/src/v1_19/api/certificates/v1/certificate_signing_request.rs index 0402615eed..32030b6c3f 100644 --- a/src/v1_19/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_19/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/certificates/v1beta1/certificate_signing_request.rs b/src/v1_19/api/certificates/v1beta1/certificate_signing_request.rs index 2109ea28f7..8522453ec0 100644 --- a/src/v1_19/api/certificates/v1beta1/certificate_signing_request.rs +++ b/src/v1_19/api/certificates/v1beta1/certificate_signing_request.rs @@ -74,7 +74,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/coordination/v1/lease.rs b/src/v1_19/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_19/api/coordination/v1/lease.rs +++ b/src/v1_19/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/coordination/v1beta1/lease.rs b/src/v1_19/api/coordination/v1beta1/lease.rs index a8267dfd8a..263fc67135 100644 --- a/src/v1_19/api/coordination/v1beta1/lease.rs +++ b/src/v1_19/api/coordination/v1beta1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/config_map.rs b/src/v1_19/api/core/v1/config_map.rs index 9f09742739..ddc3726220 100644 --- a/src/v1_19/api/core/v1/config_map.rs +++ b/src/v1_19/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/endpoints.rs b/src/v1_19/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_19/api/core/v1/endpoints.rs +++ b/src/v1_19/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/event.rs b/src/v1_19/api/core/v1/event.rs index 49d2c275bd..a4d6d8ffc4 100644 --- a/src/v1_19/api/core/v1/event.rs +++ b/src/v1_19/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/limit_range.rs b/src/v1_19/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_19/api/core/v1/limit_range.rs +++ b/src/v1_19/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/namespace.rs b/src/v1_19/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_19/api/core/v1/namespace.rs +++ b/src/v1_19/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/node.rs b/src/v1_19/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_19/api/core/v1/node.rs +++ b/src/v1_19/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/persistent_volume.rs b/src/v1_19/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_19/api/core/v1/persistent_volume.rs +++ b/src/v1_19/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/persistent_volume_claim.rs b/src/v1_19/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_19/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_19/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/pod.rs b/src/v1_19/api/core/v1/pod.rs index 3c3be1bc29..9e0c30f83d 100644 --- a/src/v1_19/api/core/v1/pod.rs +++ b/src/v1_19/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/pod_template.rs b/src/v1_19/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_19/api/core/v1/pod_template.rs +++ b/src/v1_19/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/replication_controller.rs b/src/v1_19/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_19/api/core/v1/replication_controller.rs +++ b/src/v1_19/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/resource_quota.rs b/src/v1_19/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_19/api/core/v1/resource_quota.rs +++ b/src/v1_19/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/secret.rs b/src/v1_19/api/core/v1/secret.rs index adda293e95..1f1573a484 100644 --- a/src/v1_19/api/core/v1/secret.rs +++ b/src/v1_19/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/service.rs b/src/v1_19/api/core/v1/service.rs index 3bf7eb77a5..f21ba2eadd 100644 --- a/src/v1_19/api/core/v1/service.rs +++ b/src/v1_19/api/core/v1/service.rs @@ -628,7 +628,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/core/v1/service_account.rs b/src/v1_19/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_19/api/core/v1/service_account.rs +++ b/src/v1_19/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_19/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_19/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_19/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/events/v1/event.rs b/src/v1_19/api/events/v1/event.rs index 934e1cae7d..0407e28d07 100644 --- a/src/v1_19/api/events/v1/event.rs +++ b/src/v1_19/api/events/v1/event.rs @@ -125,7 +125,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -166,7 +171,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/events/v1beta1/event.rs b/src/v1_19/api/events/v1beta1/event.rs index d677169342..5a9e86009d 100644 --- a/src/v1_19/api/events/v1beta1/event.rs +++ b/src/v1_19/api/events/v1beta1/event.rs @@ -125,7 +125,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -166,7 +171,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/extensions/v1beta1/ingress.rs b/src/v1_19/api/extensions/v1beta1/ingress.rs index 81ae86103e..d5a813c0e0 100644 --- a/src/v1_19/api/extensions/v1beta1/ingress.rs +++ b/src/v1_19/api/extensions/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/flowcontrol/v1alpha1/flow_schema.rs b/src/v1_19/api/flowcontrol/v1alpha1/flow_schema.rs index 76ea0d9b2a..6641f0e49b 100644 --- a/src/v1_19/api/flowcontrol/v1alpha1/flow_schema.rs +++ b/src/v1_19/api/flowcontrol/v1alpha1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/flowcontrol/v1alpha1/priority_level_configuration.rs b/src/v1_19/api/flowcontrol/v1alpha1/priority_level_configuration.rs index 37f39f2e33..f7a2fd73fd 100644 --- a/src/v1_19/api/flowcontrol/v1alpha1/priority_level_configuration.rs +++ b/src/v1_19/api/flowcontrol/v1alpha1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/networking/v1/ingress.rs b/src/v1_19/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_19/api/networking/v1/ingress.rs +++ b/src/v1_19/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/networking/v1/ingress_class.rs b/src/v1_19/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_19/api/networking/v1/ingress_class.rs +++ b/src/v1_19/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/networking/v1/network_policy.rs b/src/v1_19/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_19/api/networking/v1/network_policy.rs +++ b/src/v1_19/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/networking/v1beta1/ingress.rs b/src/v1_19/api/networking/v1beta1/ingress.rs index 5710a2d555..60111b9df9 100644 --- a/src/v1_19/api/networking/v1beta1/ingress.rs +++ b/src/v1_19/api/networking/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/networking/v1beta1/ingress_class.rs b/src/v1_19/api/networking/v1beta1/ingress_class.rs index db2ed867ac..5be215bb48 100644 --- a/src/v1_19/api/networking/v1beta1/ingress_class.rs +++ b/src/v1_19/api/networking/v1beta1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/node/v1alpha1/runtime_class.rs b/src/v1_19/api/node/v1alpha1/runtime_class.rs index 5d6a98a995..df1df669f8 100644 --- a/src/v1_19/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_19/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/node/v1beta1/runtime_class.rs b/src/v1_19/api/node/v1beta1/runtime_class.rs index c7d14c2844..96bd8d1022 100644 --- a/src/v1_19/api/node/v1beta1/runtime_class.rs +++ b/src/v1_19/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_19/api/policy/v1beta1/pod_disruption_budget.rs index 0309cc15b7..cfbc071cf0 100644 --- a/src/v1_19/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_19/api/policy/v1beta1/pod_disruption_budget.rs @@ -89,7 +89,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -130,7 +135,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/policy/v1beta1/pod_security_policy.rs b/src/v1_19/api/policy/v1beta1/pod_security_policy.rs index 9d52e6c4da..69efd50636 100644 --- a/src/v1_19/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_19/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1/cluster_role.rs b/src/v1_19/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_19/api/rbac/v1/cluster_role.rs +++ b/src/v1_19/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1/cluster_role_binding.rs b/src/v1_19/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_19/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_19/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1/role.rs b/src/v1_19/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_19/api/rbac/v1/role.rs +++ b/src/v1_19/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1/role_binding.rs b/src/v1_19/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_19/api/rbac/v1/role_binding.rs +++ b/src/v1_19/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1alpha1/cluster_role.rs b/src/v1_19/api/rbac/v1alpha1/cluster_role.rs index f4f7cd6ed3..751ea258ce 100644 --- a/src/v1_19/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_19/api/rbac/v1alpha1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1alpha1/cluster_role_binding.rs b/src/v1_19/api/rbac/v1alpha1/cluster_role_binding.rs index 1bb61b787b..8d275bec1a 100644 --- a/src/v1_19/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_19/api/rbac/v1alpha1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1alpha1/role.rs b/src/v1_19/api/rbac/v1alpha1/role.rs index e796eb3bed..ed08658a2d 100644 --- a/src/v1_19/api/rbac/v1alpha1/role.rs +++ b/src/v1_19/api/rbac/v1alpha1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1alpha1/role_binding.rs b/src/v1_19/api/rbac/v1alpha1/role_binding.rs index e93ae3b4e4..f965377b92 100644 --- a/src/v1_19/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_19/api/rbac/v1alpha1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1beta1/cluster_role.rs b/src/v1_19/api/rbac/v1beta1/cluster_role.rs index 38a72b3fc4..4931e2d651 100644 --- a/src/v1_19/api/rbac/v1beta1/cluster_role.rs +++ b/src/v1_19/api/rbac/v1beta1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1beta1/cluster_role_binding.rs b/src/v1_19/api/rbac/v1beta1/cluster_role_binding.rs index 6bc011c4f8..d2773b7e9c 100644 --- a/src/v1_19/api/rbac/v1beta1/cluster_role_binding.rs +++ b/src/v1_19/api/rbac/v1beta1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1beta1/role.rs b/src/v1_19/api/rbac/v1beta1/role.rs index b422509e44..44184b4f3b 100644 --- a/src/v1_19/api/rbac/v1beta1/role.rs +++ b/src/v1_19/api/rbac/v1beta1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/rbac/v1beta1/role_binding.rs b/src/v1_19/api/rbac/v1beta1/role_binding.rs index 5bd49ea09d..a49d33a668 100644 --- a/src/v1_19/api/rbac/v1beta1/role_binding.rs +++ b/src/v1_19/api/rbac/v1beta1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/scheduling/v1/priority_class.rs b/src/v1_19/api/scheduling/v1/priority_class.rs index db95eea082..a7dba60fbd 100644 --- a/src/v1_19/api/scheduling/v1/priority_class.rs +++ b/src/v1_19/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/scheduling/v1alpha1/priority_class.rs b/src/v1_19/api/scheduling/v1alpha1/priority_class.rs index 49c745c740..992756ff0f 100644 --- a/src/v1_19/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_19/api/scheduling/v1alpha1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/scheduling/v1beta1/priority_class.rs b/src/v1_19/api/scheduling/v1beta1/priority_class.rs index b4ff3f337c..a453b71f00 100644 --- a/src/v1_19/api/scheduling/v1beta1/priority_class.rs +++ b/src/v1_19/api/scheduling/v1beta1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/settings/v1alpha1/pod_preset.rs b/src/v1_19/api/settings/v1alpha1/pod_preset.rs index 98df3ed558..5b28406b53 100644 --- a/src/v1_19/api/settings/v1alpha1/pod_preset.rs +++ b/src/v1_19/api/settings/v1alpha1/pod_preset.rs @@ -85,7 +85,12 @@ impl PodPreset { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -126,7 +131,12 @@ impl PodPreset { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1/csi_driver.rs b/src/v1_19/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_19/api/storage/v1/csi_driver.rs +++ b/src/v1_19/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1/csi_node.rs b/src/v1_19/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_19/api/storage/v1/csi_node.rs +++ b/src/v1_19/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1/storage_class.rs b/src/v1_19/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_19/api/storage/v1/storage_class.rs +++ b/src/v1_19/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1/volume_attachment.rs b/src/v1_19/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_19/api/storage/v1/volume_attachment.rs +++ b/src/v1_19/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1alpha1/volume_attachment.rs b/src/v1_19/api/storage/v1alpha1/volume_attachment.rs index 8d5275dd55..650e9a415f 100644 --- a/src/v1_19/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_19/api/storage/v1alpha1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1beta1/csi_driver.rs b/src/v1_19/api/storage/v1beta1/csi_driver.rs index 0eeca077ce..ff6e91deb5 100644 --- a/src/v1_19/api/storage/v1beta1/csi_driver.rs +++ b/src/v1_19/api/storage/v1beta1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1beta1/csi_node.rs b/src/v1_19/api/storage/v1beta1/csi_node.rs index 9b686d522d..24267a2e78 100644 --- a/src/v1_19/api/storage/v1beta1/csi_node.rs +++ b/src/v1_19/api/storage/v1beta1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1beta1/storage_class.rs b/src/v1_19/api/storage/v1beta1/storage_class.rs index e78b43c320..d8e2c027b2 100644 --- a/src/v1_19/api/storage/v1beta1/storage_class.rs +++ b/src/v1_19/api/storage/v1beta1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/api/storage/v1beta1/volume_attachment.rs b/src/v1_19/api/storage/v1beta1/volume_attachment.rs index ef7bb87db5..92ca144edc 100644 --- a/src/v1_19/api/storage/v1beta1/volume_attachment.rs +++ b/src/v1_19/api/storage/v1beta1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 45119e8bb5..56d6f38d96 100644 --- a/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs b/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs index 8f3b2a20c9..ed4d82ee89 100644 --- a/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs +++ b/src/v1_19/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 2b23f77f14..0f9b7b9c11 100644 --- a/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs b/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs index a2c933efa8..14feb9453e 100644 --- a/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs +++ b/src/v1_19/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_20/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_20/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_20/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_20/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_20/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_20/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs b/src/v1_20/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs index bc3a1b3102..775b511d0d 100644 --- a/src/v1_20/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs +++ b/src/v1_20/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/admissionregistration/v1beta1/validating_webhook_configuration.rs b/src/v1_20/api/admissionregistration/v1beta1/validating_webhook_configuration.rs index 9e878e7d68..5caa78900d 100644 --- a/src/v1_20/api/admissionregistration/v1beta1/validating_webhook_configuration.rs +++ b/src/v1_20/api/admissionregistration/v1beta1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_20/api/apiserverinternal/v1alpha1/storage_version.rs index 96388ed0a0..6b8779e542 100644 --- a/src/v1_20/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_20/api/apiserverinternal/v1alpha1/storage_version.rs @@ -77,7 +77,12 @@ impl StorageVersion { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -112,7 +117,12 @@ impl StorageVersion { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apps/v1/controller_revision.rs b/src/v1_20/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_20/api/apps/v1/controller_revision.rs +++ b/src/v1_20/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apps/v1/daemon_set.rs b/src/v1_20/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_20/api/apps/v1/daemon_set.rs +++ b/src/v1_20/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apps/v1/deployment.rs b/src/v1_20/api/apps/v1/deployment.rs index 5e44b8da7d..afb773717a 100644 --- a/src/v1_20/api/apps/v1/deployment.rs +++ b/src/v1_20/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apps/v1/replica_set.rs b/src/v1_20/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_20/api/apps/v1/replica_set.rs +++ b/src/v1_20/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/apps/v1/stateful_set.rs b/src/v1_20/api/apps/v1/stateful_set.rs index 6f07e30f3d..3495524cd3 100644 --- a/src/v1_20/api/apps/v1/stateful_set.rs +++ b/src/v1_20/api/apps/v1/stateful_set.rs @@ -92,7 +92,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -133,7 +138,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_20/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_20/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_20/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_20/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_20/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_20/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_20/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_20/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_20/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/batch/v1/job.rs b/src/v1_20/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_20/api/batch/v1/job.rs +++ b/src/v1_20/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/batch/v1beta1/cron_job.rs b/src/v1_20/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_20/api/batch/v1beta1/cron_job.rs +++ b/src/v1_20/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/batch/v2alpha1/cron_job.rs b/src/v1_20/api/batch/v2alpha1/cron_job.rs index f9f5230a3d..6e6ff4e9f6 100644 --- a/src/v1_20/api/batch/v2alpha1/cron_job.rs +++ b/src/v1_20/api/batch/v2alpha1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/certificates/v1/certificate_signing_request.rs b/src/v1_20/api/certificates/v1/certificate_signing_request.rs index 0402615eed..32030b6c3f 100644 --- a/src/v1_20/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_20/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/certificates/v1beta1/certificate_signing_request.rs b/src/v1_20/api/certificates/v1beta1/certificate_signing_request.rs index 2109ea28f7..8522453ec0 100644 --- a/src/v1_20/api/certificates/v1beta1/certificate_signing_request.rs +++ b/src/v1_20/api/certificates/v1beta1/certificate_signing_request.rs @@ -74,7 +74,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/coordination/v1/lease.rs b/src/v1_20/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_20/api/coordination/v1/lease.rs +++ b/src/v1_20/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/coordination/v1beta1/lease.rs b/src/v1_20/api/coordination/v1beta1/lease.rs index a8267dfd8a..263fc67135 100644 --- a/src/v1_20/api/coordination/v1beta1/lease.rs +++ b/src/v1_20/api/coordination/v1beta1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/config_map.rs b/src/v1_20/api/core/v1/config_map.rs index 9f09742739..ddc3726220 100644 --- a/src/v1_20/api/core/v1/config_map.rs +++ b/src/v1_20/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/endpoints.rs b/src/v1_20/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_20/api/core/v1/endpoints.rs +++ b/src/v1_20/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/event.rs b/src/v1_20/api/core/v1/event.rs index 348e3e81aa..d6f2ae1243 100644 --- a/src/v1_20/api/core/v1/event.rs +++ b/src/v1_20/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/limit_range.rs b/src/v1_20/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_20/api/core/v1/limit_range.rs +++ b/src/v1_20/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/namespace.rs b/src/v1_20/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_20/api/core/v1/namespace.rs +++ b/src/v1_20/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/node.rs b/src/v1_20/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_20/api/core/v1/node.rs +++ b/src/v1_20/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/persistent_volume.rs b/src/v1_20/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_20/api/core/v1/persistent_volume.rs +++ b/src/v1_20/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/persistent_volume_claim.rs b/src/v1_20/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_20/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_20/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/pod.rs b/src/v1_20/api/core/v1/pod.rs index 3c3be1bc29..9e0c30f83d 100644 --- a/src/v1_20/api/core/v1/pod.rs +++ b/src/v1_20/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/pod_template.rs b/src/v1_20/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_20/api/core/v1/pod_template.rs +++ b/src/v1_20/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/replication_controller.rs b/src/v1_20/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_20/api/core/v1/replication_controller.rs +++ b/src/v1_20/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/resource_quota.rs b/src/v1_20/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_20/api/core/v1/resource_quota.rs +++ b/src/v1_20/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/secret.rs b/src/v1_20/api/core/v1/secret.rs index adda293e95..1f1573a484 100644 --- a/src/v1_20/api/core/v1/secret.rs +++ b/src/v1_20/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/service.rs b/src/v1_20/api/core/v1/service.rs index 3bf7eb77a5..f21ba2eadd 100644 --- a/src/v1_20/api/core/v1/service.rs +++ b/src/v1_20/api/core/v1/service.rs @@ -628,7 +628,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/core/v1/service_account.rs b/src/v1_20/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_20/api/core/v1/service_account.rs +++ b/src/v1_20/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_20/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_20/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_20/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/events/v1/event.rs b/src/v1_20/api/events/v1/event.rs index 006efc418d..37f4bba1fb 100644 --- a/src/v1_20/api/events/v1/event.rs +++ b/src/v1_20/api/events/v1/event.rs @@ -125,7 +125,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -166,7 +171,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/events/v1beta1/event.rs b/src/v1_20/api/events/v1beta1/event.rs index f395714aab..7c282f6d66 100644 --- a/src/v1_20/api/events/v1beta1/event.rs +++ b/src/v1_20/api/events/v1beta1/event.rs @@ -125,7 +125,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -166,7 +171,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/extensions/v1beta1/ingress.rs b/src/v1_20/api/extensions/v1beta1/ingress.rs index 81ae86103e..d5a813c0e0 100644 --- a/src/v1_20/api/extensions/v1beta1/ingress.rs +++ b/src/v1_20/api/extensions/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/flowcontrol/v1alpha1/flow_schema.rs b/src/v1_20/api/flowcontrol/v1alpha1/flow_schema.rs index 76ea0d9b2a..6641f0e49b 100644 --- a/src/v1_20/api/flowcontrol/v1alpha1/flow_schema.rs +++ b/src/v1_20/api/flowcontrol/v1alpha1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/flowcontrol/v1alpha1/priority_level_configuration.rs b/src/v1_20/api/flowcontrol/v1alpha1/priority_level_configuration.rs index 37f39f2e33..f7a2fd73fd 100644 --- a/src/v1_20/api/flowcontrol/v1alpha1/priority_level_configuration.rs +++ b/src/v1_20/api/flowcontrol/v1alpha1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_20/api/flowcontrol/v1beta1/flow_schema.rs index 2b3537c21b..1d0546a710 100644 --- a/src/v1_20/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_20/api/flowcontrol/v1beta1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_20/api/flowcontrol/v1beta1/priority_level_configuration.rs index 69ebffe7cc..4cbe999e32 100644 --- a/src/v1_20/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_20/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/networking/v1/ingress.rs b/src/v1_20/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_20/api/networking/v1/ingress.rs +++ b/src/v1_20/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/networking/v1/ingress_class.rs b/src/v1_20/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_20/api/networking/v1/ingress_class.rs +++ b/src/v1_20/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/networking/v1/network_policy.rs b/src/v1_20/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_20/api/networking/v1/network_policy.rs +++ b/src/v1_20/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/networking/v1beta1/ingress.rs b/src/v1_20/api/networking/v1beta1/ingress.rs index 5710a2d555..60111b9df9 100644 --- a/src/v1_20/api/networking/v1beta1/ingress.rs +++ b/src/v1_20/api/networking/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/networking/v1beta1/ingress_class.rs b/src/v1_20/api/networking/v1beta1/ingress_class.rs index db2ed867ac..5be215bb48 100644 --- a/src/v1_20/api/networking/v1beta1/ingress_class.rs +++ b/src/v1_20/api/networking/v1beta1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/node/v1/runtime_class.rs b/src/v1_20/api/node/v1/runtime_class.rs index d4c8fea0bd..b8b7e6e539 100644 --- a/src/v1_20/api/node/v1/runtime_class.rs +++ b/src/v1_20/api/node/v1/runtime_class.rs @@ -81,7 +81,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/node/v1alpha1/runtime_class.rs b/src/v1_20/api/node/v1alpha1/runtime_class.rs index 5d6a98a995..df1df669f8 100644 --- a/src/v1_20/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_20/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/node/v1beta1/runtime_class.rs b/src/v1_20/api/node/v1beta1/runtime_class.rs index c2ef7ffa48..fc8dfaf5cc 100644 --- a/src/v1_20/api/node/v1beta1/runtime_class.rs +++ b/src/v1_20/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_20/api/policy/v1beta1/pod_disruption_budget.rs index 0309cc15b7..cfbc071cf0 100644 --- a/src/v1_20/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_20/api/policy/v1beta1/pod_disruption_budget.rs @@ -89,7 +89,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -130,7 +135,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/policy/v1beta1/pod_security_policy.rs b/src/v1_20/api/policy/v1beta1/pod_security_policy.rs index 9d52e6c4da..69efd50636 100644 --- a/src/v1_20/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_20/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1/cluster_role.rs b/src/v1_20/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_20/api/rbac/v1/cluster_role.rs +++ b/src/v1_20/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1/cluster_role_binding.rs b/src/v1_20/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_20/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_20/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1/role.rs b/src/v1_20/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_20/api/rbac/v1/role.rs +++ b/src/v1_20/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1/role_binding.rs b/src/v1_20/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_20/api/rbac/v1/role_binding.rs +++ b/src/v1_20/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1alpha1/cluster_role.rs b/src/v1_20/api/rbac/v1alpha1/cluster_role.rs index f4f7cd6ed3..751ea258ce 100644 --- a/src/v1_20/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_20/api/rbac/v1alpha1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1alpha1/cluster_role_binding.rs b/src/v1_20/api/rbac/v1alpha1/cluster_role_binding.rs index 1bb61b787b..8d275bec1a 100644 --- a/src/v1_20/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_20/api/rbac/v1alpha1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1alpha1/role.rs b/src/v1_20/api/rbac/v1alpha1/role.rs index e796eb3bed..ed08658a2d 100644 --- a/src/v1_20/api/rbac/v1alpha1/role.rs +++ b/src/v1_20/api/rbac/v1alpha1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1alpha1/role_binding.rs b/src/v1_20/api/rbac/v1alpha1/role_binding.rs index e93ae3b4e4..f965377b92 100644 --- a/src/v1_20/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_20/api/rbac/v1alpha1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1beta1/cluster_role.rs b/src/v1_20/api/rbac/v1beta1/cluster_role.rs index 38a72b3fc4..4931e2d651 100644 --- a/src/v1_20/api/rbac/v1beta1/cluster_role.rs +++ b/src/v1_20/api/rbac/v1beta1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1beta1/cluster_role_binding.rs b/src/v1_20/api/rbac/v1beta1/cluster_role_binding.rs index 6bc011c4f8..d2773b7e9c 100644 --- a/src/v1_20/api/rbac/v1beta1/cluster_role_binding.rs +++ b/src/v1_20/api/rbac/v1beta1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1beta1/role.rs b/src/v1_20/api/rbac/v1beta1/role.rs index b422509e44..44184b4f3b 100644 --- a/src/v1_20/api/rbac/v1beta1/role.rs +++ b/src/v1_20/api/rbac/v1beta1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/rbac/v1beta1/role_binding.rs b/src/v1_20/api/rbac/v1beta1/role_binding.rs index 5bd49ea09d..a49d33a668 100644 --- a/src/v1_20/api/rbac/v1beta1/role_binding.rs +++ b/src/v1_20/api/rbac/v1beta1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/scheduling/v1/priority_class.rs b/src/v1_20/api/scheduling/v1/priority_class.rs index db95eea082..a7dba60fbd 100644 --- a/src/v1_20/api/scheduling/v1/priority_class.rs +++ b/src/v1_20/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/scheduling/v1alpha1/priority_class.rs b/src/v1_20/api/scheduling/v1alpha1/priority_class.rs index 49c745c740..992756ff0f 100644 --- a/src/v1_20/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_20/api/scheduling/v1alpha1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/scheduling/v1beta1/priority_class.rs b/src/v1_20/api/scheduling/v1beta1/priority_class.rs index b4ff3f337c..a453b71f00 100644 --- a/src/v1_20/api/scheduling/v1beta1/priority_class.rs +++ b/src/v1_20/api/scheduling/v1beta1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1/csi_driver.rs b/src/v1_20/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_20/api/storage/v1/csi_driver.rs +++ b/src/v1_20/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1/csi_node.rs b/src/v1_20/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_20/api/storage/v1/csi_node.rs +++ b/src/v1_20/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1/storage_class.rs b/src/v1_20/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_20/api/storage/v1/storage_class.rs +++ b/src/v1_20/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1/volume_attachment.rs b/src/v1_20/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_20/api/storage/v1/volume_attachment.rs +++ b/src/v1_20/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1alpha1/volume_attachment.rs b/src/v1_20/api/storage/v1alpha1/volume_attachment.rs index 8d5275dd55..650e9a415f 100644 --- a/src/v1_20/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_20/api/storage/v1alpha1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1beta1/csi_driver.rs b/src/v1_20/api/storage/v1beta1/csi_driver.rs index 0eeca077ce..ff6e91deb5 100644 --- a/src/v1_20/api/storage/v1beta1/csi_driver.rs +++ b/src/v1_20/api/storage/v1beta1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1beta1/csi_node.rs b/src/v1_20/api/storage/v1beta1/csi_node.rs index 9b686d522d..24267a2e78 100644 --- a/src/v1_20/api/storage/v1beta1/csi_node.rs +++ b/src/v1_20/api/storage/v1beta1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1beta1/storage_class.rs b/src/v1_20/api/storage/v1beta1/storage_class.rs index e78b43c320..d8e2c027b2 100644 --- a/src/v1_20/api/storage/v1beta1/storage_class.rs +++ b/src/v1_20/api/storage/v1beta1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/api/storage/v1beta1/volume_attachment.rs b/src/v1_20/api/storage/v1beta1/volume_attachment.rs index ef7bb87db5..92ca144edc 100644 --- a/src/v1_20/api/storage/v1beta1/volume_attachment.rs +++ b/src/v1_20/api/storage/v1beta1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 45119e8bb5..56d6f38d96 100644 --- a/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs b/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs index 8f3b2a20c9..ed4d82ee89 100644 --- a/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs +++ b/src/v1_20/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 2b23f77f14..0f9b7b9c11 100644 --- a/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs b/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs index a2c933efa8..14feb9453e 100644 --- a/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs +++ b/src/v1_20/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_21/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_21/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_21/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_21/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_21/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_21/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs b/src/v1_21/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs index bc3a1b3102..775b511d0d 100644 --- a/src/v1_21/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs +++ b/src/v1_21/api/admissionregistration/v1beta1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/admissionregistration/v1beta1/validating_webhook_configuration.rs b/src/v1_21/api/admissionregistration/v1beta1/validating_webhook_configuration.rs index 9e878e7d68..5caa78900d 100644 --- a/src/v1_21/api/admissionregistration/v1beta1/validating_webhook_configuration.rs +++ b/src/v1_21/api/admissionregistration/v1beta1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_21/api/apiserverinternal/v1alpha1/storage_version.rs index 96388ed0a0..6b8779e542 100644 --- a/src/v1_21/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_21/api/apiserverinternal/v1alpha1/storage_version.rs @@ -77,7 +77,12 @@ impl StorageVersion { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -112,7 +117,12 @@ impl StorageVersion { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apps/v1/controller_revision.rs b/src/v1_21/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_21/api/apps/v1/controller_revision.rs +++ b/src/v1_21/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apps/v1/daemon_set.rs b/src/v1_21/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_21/api/apps/v1/daemon_set.rs +++ b/src/v1_21/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apps/v1/deployment.rs b/src/v1_21/api/apps/v1/deployment.rs index 5e44b8da7d..afb773717a 100644 --- a/src/v1_21/api/apps/v1/deployment.rs +++ b/src/v1_21/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apps/v1/replica_set.rs b/src/v1_21/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_21/api/apps/v1/replica_set.rs +++ b/src/v1_21/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/apps/v1/stateful_set.rs b/src/v1_21/api/apps/v1/stateful_set.rs index 6f07e30f3d..3495524cd3 100644 --- a/src/v1_21/api/apps/v1/stateful_set.rs +++ b/src/v1_21/api/apps/v1/stateful_set.rs @@ -92,7 +92,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -133,7 +138,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_21/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_21/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_21/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_21/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_21/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_21/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_21/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_21/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_21/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/batch/v1/cron_job.rs b/src/v1_21/api/batch/v1/cron_job.rs index f1e8734abb..7d5e4f4f63 100644 --- a/src/v1_21/api/batch/v1/cron_job.rs +++ b/src/v1_21/api/batch/v1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/batch/v1/job.rs b/src/v1_21/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_21/api/batch/v1/job.rs +++ b/src/v1_21/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/batch/v1beta1/cron_job.rs b/src/v1_21/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_21/api/batch/v1beta1/cron_job.rs +++ b/src/v1_21/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/certificates/v1/certificate_signing_request.rs b/src/v1_21/api/certificates/v1/certificate_signing_request.rs index 0402615eed..32030b6c3f 100644 --- a/src/v1_21/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_21/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/certificates/v1beta1/certificate_signing_request.rs b/src/v1_21/api/certificates/v1beta1/certificate_signing_request.rs index 2109ea28f7..8522453ec0 100644 --- a/src/v1_21/api/certificates/v1beta1/certificate_signing_request.rs +++ b/src/v1_21/api/certificates/v1beta1/certificate_signing_request.rs @@ -74,7 +74,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/coordination/v1/lease.rs b/src/v1_21/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_21/api/coordination/v1/lease.rs +++ b/src/v1_21/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/coordination/v1beta1/lease.rs b/src/v1_21/api/coordination/v1beta1/lease.rs index a8267dfd8a..263fc67135 100644 --- a/src/v1_21/api/coordination/v1beta1/lease.rs +++ b/src/v1_21/api/coordination/v1beta1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/config_map.rs b/src/v1_21/api/core/v1/config_map.rs index 9b95ccdab6..361b45a3a1 100644 --- a/src/v1_21/api/core/v1/config_map.rs +++ b/src/v1_21/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/endpoints.rs b/src/v1_21/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_21/api/core/v1/endpoints.rs +++ b/src/v1_21/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/event.rs b/src/v1_21/api/core/v1/event.rs index 348e3e81aa..d6f2ae1243 100644 --- a/src/v1_21/api/core/v1/event.rs +++ b/src/v1_21/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/limit_range.rs b/src/v1_21/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_21/api/core/v1/limit_range.rs +++ b/src/v1_21/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/namespace.rs b/src/v1_21/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_21/api/core/v1/namespace.rs +++ b/src/v1_21/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/node.rs b/src/v1_21/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_21/api/core/v1/node.rs +++ b/src/v1_21/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/persistent_volume.rs b/src/v1_21/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_21/api/core/v1/persistent_volume.rs +++ b/src/v1_21/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/persistent_volume_claim.rs b/src/v1_21/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_21/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_21/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/pod.rs b/src/v1_21/api/core/v1/pod.rs index 3c3be1bc29..9e0c30f83d 100644 --- a/src/v1_21/api/core/v1/pod.rs +++ b/src/v1_21/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/pod_template.rs b/src/v1_21/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_21/api/core/v1/pod_template.rs +++ b/src/v1_21/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/replication_controller.rs b/src/v1_21/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_21/api/core/v1/replication_controller.rs +++ b/src/v1_21/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/resource_quota.rs b/src/v1_21/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_21/api/core/v1/resource_quota.rs +++ b/src/v1_21/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/secret.rs b/src/v1_21/api/core/v1/secret.rs index 951861dbb9..17a5601b57 100644 --- a/src/v1_21/api/core/v1/secret.rs +++ b/src/v1_21/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/service.rs b/src/v1_21/api/core/v1/service.rs index 3bf7eb77a5..f21ba2eadd 100644 --- a/src/v1_21/api/core/v1/service.rs +++ b/src/v1_21/api/core/v1/service.rs @@ -628,7 +628,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/core/v1/service_account.rs b/src/v1_21/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_21/api/core/v1/service_account.rs +++ b/src/v1_21/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/discovery/v1/endpoint_slice.rs b/src/v1_21/api/discovery/v1/endpoint_slice.rs index b20e48aa51..9b2dd33f92 100644 --- a/src/v1_21/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_21/api/discovery/v1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_21/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_21/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_21/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/events/v1/event.rs b/src/v1_21/api/events/v1/event.rs index 6d32328364..b851702d6d 100644 --- a/src/v1_21/api/events/v1/event.rs +++ b/src/v1_21/api/events/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/events/v1beta1/event.rs b/src/v1_21/api/events/v1beta1/event.rs index a2e620cd7d..2b57b1371d 100644 --- a/src/v1_21/api/events/v1beta1/event.rs +++ b/src/v1_21/api/events/v1beta1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/extensions/v1beta1/ingress.rs b/src/v1_21/api/extensions/v1beta1/ingress.rs index 81ae86103e..d5a813c0e0 100644 --- a/src/v1_21/api/extensions/v1beta1/ingress.rs +++ b/src/v1_21/api/extensions/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_21/api/flowcontrol/v1beta1/flow_schema.rs index 2b3537c21b..1d0546a710 100644 --- a/src/v1_21/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_21/api/flowcontrol/v1beta1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_21/api/flowcontrol/v1beta1/priority_level_configuration.rs index 69ebffe7cc..4cbe999e32 100644 --- a/src/v1_21/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_21/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/networking/v1/ingress.rs b/src/v1_21/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_21/api/networking/v1/ingress.rs +++ b/src/v1_21/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/networking/v1/ingress_class.rs b/src/v1_21/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_21/api/networking/v1/ingress_class.rs +++ b/src/v1_21/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/networking/v1/network_policy.rs b/src/v1_21/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_21/api/networking/v1/network_policy.rs +++ b/src/v1_21/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/networking/v1beta1/ingress.rs b/src/v1_21/api/networking/v1beta1/ingress.rs index 5710a2d555..60111b9df9 100644 --- a/src/v1_21/api/networking/v1beta1/ingress.rs +++ b/src/v1_21/api/networking/v1beta1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/networking/v1beta1/ingress_class.rs b/src/v1_21/api/networking/v1beta1/ingress_class.rs index db2ed867ac..5be215bb48 100644 --- a/src/v1_21/api/networking/v1beta1/ingress_class.rs +++ b/src/v1_21/api/networking/v1beta1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/node/v1/runtime_class.rs b/src/v1_21/api/node/v1/runtime_class.rs index d4c8fea0bd..b8b7e6e539 100644 --- a/src/v1_21/api/node/v1/runtime_class.rs +++ b/src/v1_21/api/node/v1/runtime_class.rs @@ -81,7 +81,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/node/v1alpha1/runtime_class.rs b/src/v1_21/api/node/v1alpha1/runtime_class.rs index 5d6a98a995..df1df669f8 100644 --- a/src/v1_21/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_21/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/node/v1beta1/runtime_class.rs b/src/v1_21/api/node/v1beta1/runtime_class.rs index c2ef7ffa48..fc8dfaf5cc 100644 --- a/src/v1_21/api/node/v1beta1/runtime_class.rs +++ b/src/v1_21/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/policy/v1/pod_disruption_budget.rs b/src/v1_21/api/policy/v1/pod_disruption_budget.rs index f36c5b0b90..72f7294f71 100644 --- a/src/v1_21/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_21/api/policy/v1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_21/api/policy/v1beta1/pod_disruption_budget.rs index 0309cc15b7..cfbc071cf0 100644 --- a/src/v1_21/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_21/api/policy/v1beta1/pod_disruption_budget.rs @@ -89,7 +89,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -130,7 +135,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/policy/v1beta1/pod_security_policy.rs b/src/v1_21/api/policy/v1beta1/pod_security_policy.rs index 5fd8ba6363..1a515209d1 100644 --- a/src/v1_21/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_21/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1/cluster_role.rs b/src/v1_21/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_21/api/rbac/v1/cluster_role.rs +++ b/src/v1_21/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1/cluster_role_binding.rs b/src/v1_21/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_21/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_21/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1/role.rs b/src/v1_21/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_21/api/rbac/v1/role.rs +++ b/src/v1_21/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1/role_binding.rs b/src/v1_21/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_21/api/rbac/v1/role_binding.rs +++ b/src/v1_21/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1alpha1/cluster_role.rs b/src/v1_21/api/rbac/v1alpha1/cluster_role.rs index f4f7cd6ed3..751ea258ce 100644 --- a/src/v1_21/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_21/api/rbac/v1alpha1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1alpha1/cluster_role_binding.rs b/src/v1_21/api/rbac/v1alpha1/cluster_role_binding.rs index 1bb61b787b..8d275bec1a 100644 --- a/src/v1_21/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_21/api/rbac/v1alpha1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1alpha1/role.rs b/src/v1_21/api/rbac/v1alpha1/role.rs index e796eb3bed..ed08658a2d 100644 --- a/src/v1_21/api/rbac/v1alpha1/role.rs +++ b/src/v1_21/api/rbac/v1alpha1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1alpha1/role_binding.rs b/src/v1_21/api/rbac/v1alpha1/role_binding.rs index e93ae3b4e4..f965377b92 100644 --- a/src/v1_21/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_21/api/rbac/v1alpha1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1beta1/cluster_role.rs b/src/v1_21/api/rbac/v1beta1/cluster_role.rs index 38a72b3fc4..4931e2d651 100644 --- a/src/v1_21/api/rbac/v1beta1/cluster_role.rs +++ b/src/v1_21/api/rbac/v1beta1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1beta1/cluster_role_binding.rs b/src/v1_21/api/rbac/v1beta1/cluster_role_binding.rs index 6bc011c4f8..d2773b7e9c 100644 --- a/src/v1_21/api/rbac/v1beta1/cluster_role_binding.rs +++ b/src/v1_21/api/rbac/v1beta1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1beta1/role.rs b/src/v1_21/api/rbac/v1beta1/role.rs index b422509e44..44184b4f3b 100644 --- a/src/v1_21/api/rbac/v1beta1/role.rs +++ b/src/v1_21/api/rbac/v1beta1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/rbac/v1beta1/role_binding.rs b/src/v1_21/api/rbac/v1beta1/role_binding.rs index 5bd49ea09d..a49d33a668 100644 --- a/src/v1_21/api/rbac/v1beta1/role_binding.rs +++ b/src/v1_21/api/rbac/v1beta1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/scheduling/v1/priority_class.rs b/src/v1_21/api/scheduling/v1/priority_class.rs index db95eea082..a7dba60fbd 100644 --- a/src/v1_21/api/scheduling/v1/priority_class.rs +++ b/src/v1_21/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/scheduling/v1alpha1/priority_class.rs b/src/v1_21/api/scheduling/v1alpha1/priority_class.rs index 49c745c740..992756ff0f 100644 --- a/src/v1_21/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_21/api/scheduling/v1alpha1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/scheduling/v1beta1/priority_class.rs b/src/v1_21/api/scheduling/v1beta1/priority_class.rs index b4ff3f337c..a453b71f00 100644 --- a/src/v1_21/api/scheduling/v1beta1/priority_class.rs +++ b/src/v1_21/api/scheduling/v1beta1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1/csi_driver.rs b/src/v1_21/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_21/api/storage/v1/csi_driver.rs +++ b/src/v1_21/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1/csi_node.rs b/src/v1_21/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_21/api/storage/v1/csi_node.rs +++ b/src/v1_21/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1/storage_class.rs b/src/v1_21/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_21/api/storage/v1/storage_class.rs +++ b/src/v1_21/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1/volume_attachment.rs b/src/v1_21/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_21/api/storage/v1/volume_attachment.rs +++ b/src/v1_21/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1alpha1/csi_storage_capacity.rs b/src/v1_21/api/storage/v1alpha1/csi_storage_capacity.rs index d4b24dc249..5d4e7656c1 100644 --- a/src/v1_21/api/storage/v1alpha1/csi_storage_capacity.rs +++ b/src/v1_21/api/storage/v1alpha1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1alpha1/volume_attachment.rs b/src/v1_21/api/storage/v1alpha1/volume_attachment.rs index 8d5275dd55..650e9a415f 100644 --- a/src/v1_21/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_21/api/storage/v1alpha1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1beta1/csi_driver.rs b/src/v1_21/api/storage/v1beta1/csi_driver.rs index 0eeca077ce..ff6e91deb5 100644 --- a/src/v1_21/api/storage/v1beta1/csi_driver.rs +++ b/src/v1_21/api/storage/v1beta1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1beta1/csi_node.rs b/src/v1_21/api/storage/v1beta1/csi_node.rs index 9b686d522d..24267a2e78 100644 --- a/src/v1_21/api/storage/v1beta1/csi_node.rs +++ b/src/v1_21/api/storage/v1beta1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_21/api/storage/v1beta1/csi_storage_capacity.rs index b5e0545a5e..f3b5e51d4d 100644 --- a/src/v1_21/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_21/api/storage/v1beta1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1beta1/storage_class.rs b/src/v1_21/api/storage/v1beta1/storage_class.rs index e78b43c320..d8e2c027b2 100644 --- a/src/v1_21/api/storage/v1beta1/storage_class.rs +++ b/src/v1_21/api/storage/v1beta1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/api/storage/v1beta1/volume_attachment.rs b/src/v1_21/api/storage/v1beta1/volume_attachment.rs index ef7bb87db5..92ca144edc 100644 --- a/src/v1_21/api/storage/v1beta1/volume_attachment.rs +++ b/src/v1_21/api/storage/v1beta1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 45119e8bb5..56d6f38d96 100644 --- a/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs b/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs index 8f3b2a20c9..ed4d82ee89 100644 --- a/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs +++ b/src/v1_21/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition.rs @@ -75,7 +75,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 2b23f77f14..0f9b7b9c11 100644 --- a/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs b/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs index a2c933efa8..14feb9453e 100644 --- a/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs +++ b/src/v1_21/kube_aggregator/pkg/apis/apiregistration/v1beta1/api_service.rs @@ -74,7 +74,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -110,7 +115,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs index 96388ed0a0..6b8779e542 100644 --- a/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs @@ -77,7 +77,12 @@ impl StorageVersion { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -112,7 +117,12 @@ impl StorageVersion { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apps/v1/controller_revision.rs b/src/v1_22/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_22/api/apps/v1/controller_revision.rs +++ b/src/v1_22/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apps/v1/daemon_set.rs b/src/v1_22/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_22/api/apps/v1/daemon_set.rs +++ b/src/v1_22/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apps/v1/deployment.rs b/src/v1_22/api/apps/v1/deployment.rs index 6ad88aa356..f8d215b273 100644 --- a/src/v1_22/api/apps/v1/deployment.rs +++ b/src/v1_22/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apps/v1/replica_set.rs b/src/v1_22/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_22/api/apps/v1/replica_set.rs +++ b/src/v1_22/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/apps/v1/stateful_set.rs b/src/v1_22/api/apps/v1/stateful_set.rs index 1a246e4a61..5c62142458 100644 --- a/src/v1_22/api/apps/v1/stateful_set.rs +++ b/src/v1_22/api/apps/v1/stateful_set.rs @@ -93,7 +93,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/batch/v1/cron_job.rs b/src/v1_22/api/batch/v1/cron_job.rs index f1e8734abb..7d5e4f4f63 100644 --- a/src/v1_22/api/batch/v1/cron_job.rs +++ b/src/v1_22/api/batch/v1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/batch/v1/job.rs b/src/v1_22/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_22/api/batch/v1/job.rs +++ b/src/v1_22/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/batch/v1beta1/cron_job.rs b/src/v1_22/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_22/api/batch/v1beta1/cron_job.rs +++ b/src/v1_22/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/certificates/v1/certificate_signing_request.rs b/src/v1_22/api/certificates/v1/certificate_signing_request.rs index c99f36a892..066a900b7c 100644 --- a/src/v1_22/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_22/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/coordination/v1/lease.rs b/src/v1_22/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_22/api/coordination/v1/lease.rs +++ b/src/v1_22/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/config_map.rs b/src/v1_22/api/core/v1/config_map.rs index 9b95ccdab6..361b45a3a1 100644 --- a/src/v1_22/api/core/v1/config_map.rs +++ b/src/v1_22/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/endpoints.rs b/src/v1_22/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_22/api/core/v1/endpoints.rs +++ b/src/v1_22/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/event.rs b/src/v1_22/api/core/v1/event.rs index 348e3e81aa..d6f2ae1243 100644 --- a/src/v1_22/api/core/v1/event.rs +++ b/src/v1_22/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/limit_range.rs b/src/v1_22/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_22/api/core/v1/limit_range.rs +++ b/src/v1_22/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/namespace.rs b/src/v1_22/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_22/api/core/v1/namespace.rs +++ b/src/v1_22/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/node.rs b/src/v1_22/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_22/api/core/v1/node.rs +++ b/src/v1_22/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/persistent_volume.rs b/src/v1_22/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_22/api/core/v1/persistent_volume.rs +++ b/src/v1_22/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/persistent_volume_claim.rs b/src/v1_22/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_22/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_22/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/pod.rs b/src/v1_22/api/core/v1/pod.rs index 9102c150e9..a24c02fdd4 100644 --- a/src/v1_22/api/core/v1/pod.rs +++ b/src/v1_22/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/pod_template.rs b/src/v1_22/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_22/api/core/v1/pod_template.rs +++ b/src/v1_22/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/replication_controller.rs b/src/v1_22/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_22/api/core/v1/replication_controller.rs +++ b/src/v1_22/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/resource_quota.rs b/src/v1_22/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_22/api/core/v1/resource_quota.rs +++ b/src/v1_22/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/secret.rs b/src/v1_22/api/core/v1/secret.rs index 951861dbb9..17a5601b57 100644 --- a/src/v1_22/api/core/v1/secret.rs +++ b/src/v1_22/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/service.rs b/src/v1_22/api/core/v1/service.rs index 3bf7eb77a5..f21ba2eadd 100644 --- a/src/v1_22/api/core/v1/service.rs +++ b/src/v1_22/api/core/v1/service.rs @@ -628,7 +628,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/core/v1/service_account.rs b/src/v1_22/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_22/api/core/v1/service_account.rs +++ b/src/v1_22/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/discovery/v1/endpoint_slice.rs b/src/v1_22/api/discovery/v1/endpoint_slice.rs index b20e48aa51..9b2dd33f92 100644 --- a/src/v1_22/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_22/api/discovery/v1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/events/v1/event.rs b/src/v1_22/api/events/v1/event.rs index 6d32328364..b851702d6d 100644 --- a/src/v1_22/api/events/v1/event.rs +++ b/src/v1_22/api/events/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/events/v1beta1/event.rs b/src/v1_22/api/events/v1beta1/event.rs index a2e620cd7d..2b57b1371d 100644 --- a/src/v1_22/api/events/v1beta1/event.rs +++ b/src/v1_22/api/events/v1beta1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs index 2b3537c21b..1d0546a710 100644 --- a/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs index 69ebffe7cc..4cbe999e32 100644 --- a/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/networking/v1/ingress.rs b/src/v1_22/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_22/api/networking/v1/ingress.rs +++ b/src/v1_22/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/networking/v1/ingress_class.rs b/src/v1_22/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_22/api/networking/v1/ingress_class.rs +++ b/src/v1_22/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/networking/v1/network_policy.rs b/src/v1_22/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_22/api/networking/v1/network_policy.rs +++ b/src/v1_22/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/node/v1/runtime_class.rs b/src/v1_22/api/node/v1/runtime_class.rs index d4c8fea0bd..b8b7e6e539 100644 --- a/src/v1_22/api/node/v1/runtime_class.rs +++ b/src/v1_22/api/node/v1/runtime_class.rs @@ -81,7 +81,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/node/v1alpha1/runtime_class.rs b/src/v1_22/api/node/v1alpha1/runtime_class.rs index f7832b7c0d..3d28fafe49 100644 --- a/src/v1_22/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_22/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/node/v1beta1/runtime_class.rs b/src/v1_22/api/node/v1beta1/runtime_class.rs index 65e084cddb..9963c70a08 100644 --- a/src/v1_22/api/node/v1beta1/runtime_class.rs +++ b/src/v1_22/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/policy/v1/pod_disruption_budget.rs b/src/v1_22/api/policy/v1/pod_disruption_budget.rs index f36c5b0b90..72f7294f71 100644 --- a/src/v1_22/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_22/api/policy/v1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs index 9506a842b3..cee96e2f07 100644 --- a/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/policy/v1beta1/pod_security_policy.rs b/src/v1_22/api/policy/v1beta1/pod_security_policy.rs index 5fd8ba6363..1a515209d1 100644 --- a/src/v1_22/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_22/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1/cluster_role.rs b/src/v1_22/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_22/api/rbac/v1/cluster_role.rs +++ b/src/v1_22/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1/cluster_role_binding.rs b/src/v1_22/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_22/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_22/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1/role.rs b/src/v1_22/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_22/api/rbac/v1/role.rs +++ b/src/v1_22/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1/role_binding.rs b/src/v1_22/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_22/api/rbac/v1/role_binding.rs +++ b/src/v1_22/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1alpha1/cluster_role.rs b/src/v1_22/api/rbac/v1alpha1/cluster_role.rs index f4f7cd6ed3..751ea258ce 100644 --- a/src/v1_22/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_22/api/rbac/v1alpha1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs b/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs index 1bb61b787b..8d275bec1a 100644 --- a/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1alpha1/role.rs b/src/v1_22/api/rbac/v1alpha1/role.rs index e796eb3bed..ed08658a2d 100644 --- a/src/v1_22/api/rbac/v1alpha1/role.rs +++ b/src/v1_22/api/rbac/v1alpha1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/rbac/v1alpha1/role_binding.rs b/src/v1_22/api/rbac/v1alpha1/role_binding.rs index e93ae3b4e4..f965377b92 100644 --- a/src/v1_22/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_22/api/rbac/v1alpha1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/scheduling/v1/priority_class.rs b/src/v1_22/api/scheduling/v1/priority_class.rs index db95eea082..a7dba60fbd 100644 --- a/src/v1_22/api/scheduling/v1/priority_class.rs +++ b/src/v1_22/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/scheduling/v1alpha1/priority_class.rs b/src/v1_22/api/scheduling/v1alpha1/priority_class.rs index 49c745c740..992756ff0f 100644 --- a/src/v1_22/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_22/api/scheduling/v1alpha1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1/csi_driver.rs b/src/v1_22/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_22/api/storage/v1/csi_driver.rs +++ b/src/v1_22/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1/csi_node.rs b/src/v1_22/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_22/api/storage/v1/csi_node.rs +++ b/src/v1_22/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1/storage_class.rs b/src/v1_22/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_22/api/storage/v1/storage_class.rs +++ b/src/v1_22/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1/volume_attachment.rs b/src/v1_22/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_22/api/storage/v1/volume_attachment.rs +++ b/src/v1_22/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs b/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs index d4b24dc249..5d4e7656c1 100644 --- a/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs +++ b/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1alpha1/volume_attachment.rs b/src/v1_22/api/storage/v1alpha1/volume_attachment.rs index 8d5275dd55..650e9a415f 100644 --- a/src/v1_22/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_22/api/storage/v1alpha1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs index b5e0545a5e..f3b5e51d4d 100644 --- a/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 473c6c2cc0..c05e8ea174 100644 --- a/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -76,7 +76,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 8f11870a8d..cff7ff1489 100644 --- a/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -75,7 +75,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs index 96388ed0a0..6b8779e542 100644 --- a/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs @@ -77,7 +77,12 @@ impl StorageVersion { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -112,7 +117,12 @@ impl StorageVersion { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apps/v1/controller_revision.rs b/src/v1_23/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_23/api/apps/v1/controller_revision.rs +++ b/src/v1_23/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apps/v1/daemon_set.rs b/src/v1_23/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_23/api/apps/v1/daemon_set.rs +++ b/src/v1_23/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apps/v1/deployment.rs b/src/v1_23/api/apps/v1/deployment.rs index 6ad88aa356..f8d215b273 100644 --- a/src/v1_23/api/apps/v1/deployment.rs +++ b/src/v1_23/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apps/v1/replica_set.rs b/src/v1_23/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_23/api/apps/v1/replica_set.rs +++ b/src/v1_23/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/apps/v1/stateful_set.rs b/src/v1_23/api/apps/v1/stateful_set.rs index 1a246e4a61..5c62142458 100644 --- a/src/v1_23/api/apps/v1/stateful_set.rs +++ b/src/v1_23/api/apps/v1/stateful_set.rs @@ -93,7 +93,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs index 2a1772f7d8..e3df4c800c 100644 --- a/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/batch/v1/cron_job.rs b/src/v1_23/api/batch/v1/cron_job.rs index f1e8734abb..7d5e4f4f63 100644 --- a/src/v1_23/api/batch/v1/cron_job.rs +++ b/src/v1_23/api/batch/v1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/batch/v1/job.rs b/src/v1_23/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_23/api/batch/v1/job.rs +++ b/src/v1_23/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/batch/v1beta1/cron_job.rs b/src/v1_23/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_23/api/batch/v1beta1/cron_job.rs +++ b/src/v1_23/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/certificates/v1/certificate_signing_request.rs b/src/v1_23/api/certificates/v1/certificate_signing_request.rs index c99f36a892..066a900b7c 100644 --- a/src/v1_23/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_23/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/coordination/v1/lease.rs b/src/v1_23/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_23/api/coordination/v1/lease.rs +++ b/src/v1_23/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/config_map.rs b/src/v1_23/api/core/v1/config_map.rs index 9b95ccdab6..361b45a3a1 100644 --- a/src/v1_23/api/core/v1/config_map.rs +++ b/src/v1_23/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/endpoints.rs b/src/v1_23/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_23/api/core/v1/endpoints.rs +++ b/src/v1_23/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/event.rs b/src/v1_23/api/core/v1/event.rs index 348e3e81aa..d6f2ae1243 100644 --- a/src/v1_23/api/core/v1/event.rs +++ b/src/v1_23/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/limit_range.rs b/src/v1_23/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_23/api/core/v1/limit_range.rs +++ b/src/v1_23/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/namespace.rs b/src/v1_23/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_23/api/core/v1/namespace.rs +++ b/src/v1_23/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/node.rs b/src/v1_23/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_23/api/core/v1/node.rs +++ b/src/v1_23/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/persistent_volume.rs b/src/v1_23/api/core/v1/persistent_volume.rs index 3c50b8e266..fada89f48e 100644 --- a/src/v1_23/api/core/v1/persistent_volume.rs +++ b/src/v1_23/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/persistent_volume_claim.rs b/src/v1_23/api/core/v1/persistent_volume_claim.rs index 4a02414cf4..23ef0c421c 100644 --- a/src/v1_23/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_23/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/pod.rs b/src/v1_23/api/core/v1/pod.rs index 5104bbc44d..f99a63faa1 100644 --- a/src/v1_23/api/core/v1/pod.rs +++ b/src/v1_23/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/pod_template.rs b/src/v1_23/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_23/api/core/v1/pod_template.rs +++ b/src/v1_23/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/replication_controller.rs b/src/v1_23/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_23/api/core/v1/replication_controller.rs +++ b/src/v1_23/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/resource_quota.rs b/src/v1_23/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_23/api/core/v1/resource_quota.rs +++ b/src/v1_23/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/secret.rs b/src/v1_23/api/core/v1/secret.rs index 5521cc87cd..74a33ebe09 100644 --- a/src/v1_23/api/core/v1/secret.rs +++ b/src/v1_23/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/service.rs b/src/v1_23/api/core/v1/service.rs index 00ca863c7e..d5b201c7a6 100644 --- a/src/v1_23/api/core/v1/service.rs +++ b/src/v1_23/api/core/v1/service.rs @@ -630,7 +630,12 @@ impl Service { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -671,7 +676,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/core/v1/service_account.rs b/src/v1_23/api/core/v1/service_account.rs index 1184705995..c1b334f710 100644 --- a/src/v1_23/api/core/v1/service_account.rs +++ b/src/v1_23/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/discovery/v1/endpoint_slice.rs b/src/v1_23/api/discovery/v1/endpoint_slice.rs index a194d683c6..5858e58711 100644 --- a/src/v1_23/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_23/api/discovery/v1/endpoint_slice.rs @@ -94,7 +94,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -135,7 +140,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/events/v1/event.rs b/src/v1_23/api/events/v1/event.rs index 6d32328364..b851702d6d 100644 --- a/src/v1_23/api/events/v1/event.rs +++ b/src/v1_23/api/events/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/events/v1beta1/event.rs b/src/v1_23/api/events/v1beta1/event.rs index a2e620cd7d..2b57b1371d 100644 --- a/src/v1_23/api/events/v1beta1/event.rs +++ b/src/v1_23/api/events/v1beta1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs index 2b3537c21b..1d0546a710 100644 --- a/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs index 69ebffe7cc..4cbe999e32 100644 --- a/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs index 45f85c0126..71d13230a3 100644 --- a/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs index 6fa22d050e..91ebc9f1f5 100644 --- a/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/networking/v1/ingress.rs b/src/v1_23/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_23/api/networking/v1/ingress.rs +++ b/src/v1_23/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/networking/v1/ingress_class.rs b/src/v1_23/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_23/api/networking/v1/ingress_class.rs +++ b/src/v1_23/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/networking/v1/network_policy.rs b/src/v1_23/api/networking/v1/network_policy.rs index 52ea36e27f..e7e2cd8618 100644 --- a/src/v1_23/api/networking/v1/network_policy.rs +++ b/src/v1_23/api/networking/v1/network_policy.rs @@ -87,7 +87,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/node/v1/runtime_class.rs b/src/v1_23/api/node/v1/runtime_class.rs index d4c8fea0bd..b8b7e6e539 100644 --- a/src/v1_23/api/node/v1/runtime_class.rs +++ b/src/v1_23/api/node/v1/runtime_class.rs @@ -81,7 +81,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/node/v1alpha1/runtime_class.rs b/src/v1_23/api/node/v1alpha1/runtime_class.rs index f7832b7c0d..3d28fafe49 100644 --- a/src/v1_23/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_23/api/node/v1alpha1/runtime_class.rs @@ -73,7 +73,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/node/v1beta1/runtime_class.rs b/src/v1_23/api/node/v1beta1/runtime_class.rs index 65e084cddb..9963c70a08 100644 --- a/src/v1_23/api/node/v1beta1/runtime_class.rs +++ b/src/v1_23/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/policy/v1/pod_disruption_budget.rs b/src/v1_23/api/policy/v1/pod_disruption_budget.rs index f36c5b0b90..72f7294f71 100644 --- a/src/v1_23/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_23/api/policy/v1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs index 9506a842b3..cee96e2f07 100644 --- a/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/policy/v1beta1/pod_security_policy.rs b/src/v1_23/api/policy/v1beta1/pod_security_policy.rs index 5fd8ba6363..1a515209d1 100644 --- a/src/v1_23/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_23/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/rbac/v1/cluster_role.rs b/src/v1_23/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_23/api/rbac/v1/cluster_role.rs +++ b/src/v1_23/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/rbac/v1/cluster_role_binding.rs b/src/v1_23/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_23/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_23/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/rbac/v1/role.rs b/src/v1_23/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_23/api/rbac/v1/role.rs +++ b/src/v1_23/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/rbac/v1/role_binding.rs b/src/v1_23/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_23/api/rbac/v1/role_binding.rs +++ b/src/v1_23/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/scheduling/v1/priority_class.rs b/src/v1_23/api/scheduling/v1/priority_class.rs index db95eea082..a7dba60fbd 100644 --- a/src/v1_23/api/scheduling/v1/priority_class.rs +++ b/src/v1_23/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1/csi_driver.rs b/src/v1_23/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_23/api/storage/v1/csi_driver.rs +++ b/src/v1_23/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1/csi_node.rs b/src/v1_23/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_23/api/storage/v1/csi_node.rs +++ b/src/v1_23/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1/storage_class.rs b/src/v1_23/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_23/api/storage/v1/storage_class.rs +++ b/src/v1_23/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1/volume_attachment.rs b/src/v1_23/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_23/api/storage/v1/volume_attachment.rs +++ b/src/v1_23/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs b/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs index d4b24dc249..5d4e7656c1 100644 --- a/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs +++ b/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs index b5e0545a5e..f3b5e51d4d 100644 --- a/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 473c6c2cc0..c05e8ea174 100644 --- a/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -76,7 +76,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 8f11870a8d..cff7ff1489 100644 --- a/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -75,7 +75,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs index c21fa0d377..cb8ec8f5af 100644 --- a/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl MutatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl MutatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs index 5c6b94ca57..4c520b0eeb 100644 --- a/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -73,7 +73,12 @@ impl ValidatingWebhookConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl ValidatingWebhookConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs index 9b10edc2a1..c5d811a2fd 100644 --- a/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs @@ -76,7 +76,12 @@ impl StorageVersion { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl StorageVersion { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apps/v1/controller_revision.rs b/src/v1_24/api/apps/v1/controller_revision.rs index 8c77c4cce9..fa18bb2583 100644 --- a/src/v1_24/api/apps/v1/controller_revision.rs +++ b/src/v1_24/api/apps/v1/controller_revision.rs @@ -90,7 +90,12 @@ impl ControllerRevision { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ControllerRevision { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apps/v1/daemon_set.rs b/src/v1_24/api/apps/v1/daemon_set.rs index 428def072f..6a782f979d 100644 --- a/src/v1_24/api/apps/v1/daemon_set.rs +++ b/src/v1_24/api/apps/v1/daemon_set.rs @@ -90,7 +90,12 @@ impl DaemonSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl DaemonSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apps/v1/deployment.rs b/src/v1_24/api/apps/v1/deployment.rs index 6ad88aa356..f8d215b273 100644 --- a/src/v1_24/api/apps/v1/deployment.rs +++ b/src/v1_24/api/apps/v1/deployment.rs @@ -90,7 +90,12 @@ impl Deployment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Deployment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apps/v1/replica_set.rs b/src/v1_24/api/apps/v1/replica_set.rs index d04cd821e4..41a72f7b44 100644 --- a/src/v1_24/api/apps/v1/replica_set.rs +++ b/src/v1_24/api/apps/v1/replica_set.rs @@ -90,7 +90,12 @@ impl ReplicaSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicaSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/apps/v1/stateful_set.rs b/src/v1_24/api/apps/v1/stateful_set.rs index 1a246e4a61..5c62142458 100644 --- a/src/v1_24/api/apps/v1/stateful_set.rs +++ b/src/v1_24/api/apps/v1/stateful_set.rs @@ -93,7 +93,12 @@ impl StatefulSet { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl StatefulSet { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs index c4fd7fcdb2..01ee0ebcfc 100644 --- a/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs index 2a1772f7d8..e3df4c800c 100644 --- a/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs b/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs index a7f3681f58..50b9970024 100644 --- a/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index dd4769c2fc..df7124afd7 100644 --- a/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -90,7 +90,12 @@ impl HorizontalPodAutoscaler { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl HorizontalPodAutoscaler { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/batch/v1/cron_job.rs b/src/v1_24/api/batch/v1/cron_job.rs index f1e8734abb..7d5e4f4f63 100644 --- a/src/v1_24/api/batch/v1/cron_job.rs +++ b/src/v1_24/api/batch/v1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/batch/v1/job.rs b/src/v1_24/api/batch/v1/job.rs index 585bc4c1d7..255eab956e 100644 --- a/src/v1_24/api/batch/v1/job.rs +++ b/src/v1_24/api/batch/v1/job.rs @@ -90,7 +90,12 @@ impl Job { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Job { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/batch/v1beta1/cron_job.rs b/src/v1_24/api/batch/v1beta1/cron_job.rs index 6450bbc8a5..6d31b80fcb 100644 --- a/src/v1_24/api/batch/v1beta1/cron_job.rs +++ b/src/v1_24/api/batch/v1beta1/cron_job.rs @@ -90,7 +90,12 @@ impl CronJob { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl CronJob { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/certificates/v1/certificate_signing_request.rs b/src/v1_24/api/certificates/v1/certificate_signing_request.rs index c99f36a892..066a900b7c 100644 --- a/src/v1_24/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_24/api/certificates/v1/certificate_signing_request.rs @@ -80,7 +80,12 @@ impl CertificateSigningRequest { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -116,7 +121,12 @@ impl CertificateSigningRequest { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/coordination/v1/lease.rs b/src/v1_24/api/coordination/v1/lease.rs index 3bc6158541..3e32685cbc 100644 --- a/src/v1_24/api/coordination/v1/lease.rs +++ b/src/v1_24/api/coordination/v1/lease.rs @@ -87,7 +87,12 @@ impl Lease { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Lease { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/config_map.rs b/src/v1_24/api/core/v1/config_map.rs index 9b95ccdab6..361b45a3a1 100644 --- a/src/v1_24/api/core/v1/config_map.rs +++ b/src/v1_24/api/core/v1/config_map.rs @@ -93,7 +93,12 @@ impl ConfigMap { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ConfigMap { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/endpoints.rs b/src/v1_24/api/core/v1/endpoints.rs index 6063d1b2ad..c9b545e04c 100644 --- a/src/v1_24/api/core/v1/endpoints.rs +++ b/src/v1_24/api/core/v1/endpoints.rs @@ -98,7 +98,12 @@ impl Endpoints { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -139,7 +144,12 @@ impl Endpoints { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/event.rs b/src/v1_24/api/core/v1/event.rs index 348e3e81aa..d6f2ae1243 100644 --- a/src/v1_24/api/core/v1/event.rs +++ b/src/v1_24/api/core/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/limit_range.rs b/src/v1_24/api/core/v1/limit_range.rs index 3a5bc59241..8cb5242d90 100644 --- a/src/v1_24/api/core/v1/limit_range.rs +++ b/src/v1_24/api/core/v1/limit_range.rs @@ -87,7 +87,12 @@ impl LimitRange { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl LimitRange { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/namespace.rs b/src/v1_24/api/core/v1/namespace.rs index 3601e1ccdf..df31cdc0da 100644 --- a/src/v1_24/api/core/v1/namespace.rs +++ b/src/v1_24/api/core/v1/namespace.rs @@ -75,7 +75,12 @@ impl Namespace { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/node.rs b/src/v1_24/api/core/v1/node.rs index 6918fee1c7..5a5694b818 100644 --- a/src/v1_24/api/core/v1/node.rs +++ b/src/v1_24/api/core/v1/node.rs @@ -556,7 +556,12 @@ impl Node { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -591,7 +596,12 @@ impl Node { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/persistent_volume.rs b/src/v1_24/api/core/v1/persistent_volume.rs index 449d49a5d8..c3d9dde5a2 100644 --- a/src/v1_24/api/core/v1/persistent_volume.rs +++ b/src/v1_24/api/core/v1/persistent_volume.rs @@ -76,7 +76,12 @@ impl PersistentVolume { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PersistentVolume { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/persistent_volume_claim.rs b/src/v1_24/api/core/v1/persistent_volume_claim.rs index 356f08cbaf..e882129db9 100644 --- a/src/v1_24/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_24/api/core/v1/persistent_volume_claim.rs @@ -90,7 +90,12 @@ impl PersistentVolumeClaim { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PersistentVolumeClaim { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/pod.rs b/src/v1_24/api/core/v1/pod.rs index 5104bbc44d..f99a63faa1 100644 --- a/src/v1_24/api/core/v1/pod.rs +++ b/src/v1_24/api/core/v1/pod.rs @@ -1046,7 +1046,12 @@ impl Pod { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -1087,7 +1092,12 @@ impl Pod { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/pod_template.rs b/src/v1_24/api/core/v1/pod_template.rs index 1508e4578d..5ce465ce2e 100644 --- a/src/v1_24/api/core/v1/pod_template.rs +++ b/src/v1_24/api/core/v1/pod_template.rs @@ -87,7 +87,12 @@ impl PodTemplate { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl PodTemplate { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/replication_controller.rs b/src/v1_24/api/core/v1/replication_controller.rs index e053784d1b..613bdd6f41 100644 --- a/src/v1_24/api/core/v1/replication_controller.rs +++ b/src/v1_24/api/core/v1/replication_controller.rs @@ -90,7 +90,12 @@ impl ReplicationController { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ReplicationController { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/resource_quota.rs b/src/v1_24/api/core/v1/resource_quota.rs index ea20ea664a..fac2dbab5e 100644 --- a/src/v1_24/api/core/v1/resource_quota.rs +++ b/src/v1_24/api/core/v1/resource_quota.rs @@ -90,7 +90,12 @@ impl ResourceQuota { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl ResourceQuota { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/secret.rs b/src/v1_24/api/core/v1/secret.rs index 5521cc87cd..74a33ebe09 100644 --- a/src/v1_24/api/core/v1/secret.rs +++ b/src/v1_24/api/core/v1/secret.rs @@ -96,7 +96,12 @@ impl Secret { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -137,7 +142,12 @@ impl Secret { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/service.rs b/src/v1_24/api/core/v1/service.rs index 00ca863c7e..d5b201c7a6 100644 --- a/src/v1_24/api/core/v1/service.rs +++ b/src/v1_24/api/core/v1/service.rs @@ -630,7 +630,12 @@ impl Service { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -671,7 +676,12 @@ impl Service { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/core/v1/service_account.rs b/src/v1_24/api/core/v1/service_account.rs index 893753ae33..9cc6535f2a 100644 --- a/src/v1_24/api/core/v1/service_account.rs +++ b/src/v1_24/api/core/v1/service_account.rs @@ -93,7 +93,12 @@ impl ServiceAccount { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl ServiceAccount { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/discovery/v1/endpoint_slice.rs b/src/v1_24/api/discovery/v1/endpoint_slice.rs index a194d683c6..5858e58711 100644 --- a/src/v1_24/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_24/api/discovery/v1/endpoint_slice.rs @@ -94,7 +94,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -135,7 +140,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs index 8171f10b42..cfe4553dc2 100644 --- a/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs @@ -93,7 +93,12 @@ impl EndpointSlice { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -134,7 +139,12 @@ impl EndpointSlice { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/events/v1/event.rs b/src/v1_24/api/events/v1/event.rs index 6d32328364..b851702d6d 100644 --- a/src/v1_24/api/events/v1/event.rs +++ b/src/v1_24/api/events/v1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/events/v1beta1/event.rs b/src/v1_24/api/events/v1beta1/event.rs index a2e620cd7d..2b57b1371d 100644 --- a/src/v1_24/api/events/v1beta1/event.rs +++ b/src/v1_24/api/events/v1beta1/event.rs @@ -126,7 +126,12 @@ impl Event { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -167,7 +172,12 @@ impl Event { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs index 2b3537c21b..1d0546a710 100644 --- a/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs index 69ebffe7cc..4cbe999e32 100644 --- a/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs index 45f85c0126..71d13230a3 100644 --- a/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs @@ -76,7 +76,12 @@ impl FlowSchema { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl FlowSchema { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs index 6fa22d050e..91ebc9f1f5 100644 --- a/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -76,7 +76,12 @@ impl PriorityLevelConfiguration { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl PriorityLevelConfiguration { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/networking/v1/ingress.rs b/src/v1_24/api/networking/v1/ingress.rs index d506f45bc1..c9e616121f 100644 --- a/src/v1_24/api/networking/v1/ingress.rs +++ b/src/v1_24/api/networking/v1/ingress.rs @@ -90,7 +90,12 @@ impl Ingress { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl Ingress { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/networking/v1/ingress_class.rs b/src/v1_24/api/networking/v1/ingress_class.rs index e32246319e..d3ab7820c7 100644 --- a/src/v1_24/api/networking/v1/ingress_class.rs +++ b/src/v1_24/api/networking/v1/ingress_class.rs @@ -73,7 +73,12 @@ impl IngressClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl IngressClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/networking/v1/network_policy.rs b/src/v1_24/api/networking/v1/network_policy.rs index 057a406ae6..36ed661520 100644 --- a/src/v1_24/api/networking/v1/network_policy.rs +++ b/src/v1_24/api/networking/v1/network_policy.rs @@ -90,7 +90,12 @@ impl NetworkPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl NetworkPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/node/v1/runtime_class.rs b/src/v1_24/api/node/v1/runtime_class.rs index 45148fbca8..470b9f902d 100644 --- a/src/v1_24/api/node/v1/runtime_class.rs +++ b/src/v1_24/api/node/v1/runtime_class.rs @@ -80,7 +80,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -115,7 +120,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/node/v1beta1/runtime_class.rs b/src/v1_24/api/node/v1beta1/runtime_class.rs index 89feed045e..31fffa9653 100644 --- a/src/v1_24/api/node/v1beta1/runtime_class.rs +++ b/src/v1_24/api/node/v1beta1/runtime_class.rs @@ -79,7 +79,12 @@ impl RuntimeClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -114,7 +119,12 @@ impl RuntimeClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/policy/v1/pod_disruption_budget.rs b/src/v1_24/api/policy/v1/pod_disruption_budget.rs index f36c5b0b90..72f7294f71 100644 --- a/src/v1_24/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_24/api/policy/v1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs b/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs index 9506a842b3..cee96e2f07 100644 --- a/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs @@ -90,7 +90,12 @@ impl PodDisruptionBudget { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl PodDisruptionBudget { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/policy/v1beta1/pod_security_policy.rs b/src/v1_24/api/policy/v1beta1/pod_security_policy.rs index 5fd8ba6363..1a515209d1 100644 --- a/src/v1_24/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_24/api/policy/v1beta1/pod_security_policy.rs @@ -73,7 +73,12 @@ impl PodSecurityPolicy { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl PodSecurityPolicy { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/rbac/v1/cluster_role.rs b/src/v1_24/api/rbac/v1/cluster_role.rs index 13cb8f27ac..8336e14c92 100644 --- a/src/v1_24/api/rbac/v1/cluster_role.rs +++ b/src/v1_24/api/rbac/v1/cluster_role.rs @@ -75,7 +75,12 @@ impl ClusterRole { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRole { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/rbac/v1/cluster_role_binding.rs b/src/v1_24/api/rbac/v1/cluster_role_binding.rs index 62335fcbf9..0162a1128e 100644 --- a/src/v1_24/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_24/api/rbac/v1/cluster_role_binding.rs @@ -75,7 +75,12 @@ impl ClusterRoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl ClusterRoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/rbac/v1/role.rs b/src/v1_24/api/rbac/v1/role.rs index 587b126569..9764bc7aa0 100644 --- a/src/v1_24/api/rbac/v1/role.rs +++ b/src/v1_24/api/rbac/v1/role.rs @@ -87,7 +87,12 @@ impl Role { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl Role { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/rbac/v1/role_binding.rs b/src/v1_24/api/rbac/v1/role_binding.rs index 00bae9444f..ac11e857c2 100644 --- a/src/v1_24/api/rbac/v1/role_binding.rs +++ b/src/v1_24/api/rbac/v1/role_binding.rs @@ -90,7 +90,12 @@ impl RoleBinding { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -131,7 +136,12 @@ impl RoleBinding { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/scheduling/v1/priority_class.rs b/src/v1_24/api/scheduling/v1/priority_class.rs index 00ffa2cbbf..f13f535704 100644 --- a/src/v1_24/api/scheduling/v1/priority_class.rs +++ b/src/v1_24/api/scheduling/v1/priority_class.rs @@ -82,7 +82,12 @@ impl PriorityClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -117,7 +122,12 @@ impl PriorityClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1/csi_driver.rs b/src/v1_24/api/storage/v1/csi_driver.rs index 47459036a2..0dc419fa28 100644 --- a/src/v1_24/api/storage/v1/csi_driver.rs +++ b/src/v1_24/api/storage/v1/csi_driver.rs @@ -72,7 +72,12 @@ impl CSIDriver { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSIDriver { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1/csi_node.rs b/src/v1_24/api/storage/v1/csi_node.rs index bc32138686..a514ce9bf0 100644 --- a/src/v1_24/api/storage/v1/csi_node.rs +++ b/src/v1_24/api/storage/v1/csi_node.rs @@ -72,7 +72,12 @@ impl CSINode { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -108,7 +113,12 @@ impl CSINode { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1/csi_storage_capacity.rs b/src/v1_24/api/storage/v1/csi_storage_capacity.rs index 74f98aac12..02efa5277e 100644 --- a/src/v1_24/api/storage/v1/csi_storage_capacity.rs +++ b/src/v1_24/api/storage/v1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1/storage_class.rs b/src/v1_24/api/storage/v1/storage_class.rs index 613d1bfaa1..2bf8e65456 100644 --- a/src/v1_24/api/storage/v1/storage_class.rs +++ b/src/v1_24/api/storage/v1/storage_class.rs @@ -93,7 +93,12 @@ impl StorageClass { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -128,7 +133,12 @@ impl StorageClass { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1/volume_attachment.rs b/src/v1_24/api/storage/v1/volume_attachment.rs index 549343f84e..f6b6972639 100644 --- a/src/v1_24/api/storage/v1/volume_attachment.rs +++ b/src/v1_24/api/storage/v1/volume_attachment.rs @@ -78,7 +78,12 @@ impl VolumeAttachment { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -113,7 +118,12 @@ impl VolumeAttachment { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs index 3cb68bd52e..3fdc471ce4 100644 --- a/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs @@ -112,7 +112,12 @@ impl CSIStorageCapacity { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -153,7 +158,12 @@ impl CSIStorageCapacity { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index 473c6c2cc0..c05e8ea174 100644 --- a/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -76,7 +76,12 @@ impl CustomResourceDefinition { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl CustomResourceDefinition { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index 8f11870a8d..cff7ff1489 100644 --- a/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -75,7 +75,12 @@ impl APIService { ); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)?; + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), @@ -111,7 +116,12 @@ impl APIService { let __url = __query_pairs.finish(); let __request = crate::http::Request::delete(__url); - let __body = crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)?; + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); match __request.body(__body) { Ok(request) => Ok((request, crate::ResponseBody::new)), diff --git a/src/v1_25/api/admissionregistration/mod.rs b/src/v1_25/api/admissionregistration/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/admissionregistration/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/admissionregistration/v1/mod.rs b/src/v1_25/api/admissionregistration/v1/mod.rs new file mode 100644 index 0000000000..ace31fe7fb --- /dev/null +++ b/src/v1_25/api/admissionregistration/v1/mod.rs @@ -0,0 +1,23 @@ + +mod mutating_webhook; +pub use self::mutating_webhook::MutatingWebhook; + +mod mutating_webhook_configuration; +pub use self::mutating_webhook_configuration::MutatingWebhookConfiguration; +#[cfg(feature = "api")] pub use self::mutating_webhook_configuration::ReadMutatingWebhookConfigurationResponse; + +mod rule_with_operations; +pub use self::rule_with_operations::RuleWithOperations; + +mod service_reference; +pub use self::service_reference::ServiceReference; + +mod validating_webhook; +pub use self::validating_webhook::ValidatingWebhook; + +mod validating_webhook_configuration; +pub use self::validating_webhook_configuration::ValidatingWebhookConfiguration; +#[cfg(feature = "api")] pub use self::validating_webhook_configuration::ReadValidatingWebhookConfigurationResponse; + +mod webhook_client_config; +pub use self::webhook_client_config::WebhookClientConfig; diff --git a/src/v1_25/api/admissionregistration/v1/mutating_webhook.rs b/src/v1_25/api/admissionregistration/v1/mutating_webhook.rs new file mode 100644 index 0000000000..5b1a4d833f --- /dev/null +++ b/src/v1_25/api/admissionregistration/v1/mutating_webhook.rs @@ -0,0 +1,428 @@ +// 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, + + /// 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::DeepMerge::merge_from(&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::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::DeepMerge::merge_from(&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_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, + "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_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_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_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", + "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_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_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() + }), + ), + ( + "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_25/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_25/api/admissionregistration/v1/mutating_webhook_configuration.rs new file mode 100644 index 0000000000..cb8ec8f5af --- /dev/null +++ b/src/v1_25/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -0,0 +1,560 @@ +// 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>, +} + +// Begin admissionregistration.k8s.io/v1/MutatingWebhookConfiguration + +// Generated from operation createAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// create a MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::admissionregistration::v1::MutatingWebhookConfiguration, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAdmissionregistrationV1CollectionMutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// delete collection of MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// delete a MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the MutatingWebhookConfiguration + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// list or watch objects of kind MutatingWebhookConfiguration + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// partially update the specified MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the MutatingWebhookConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// read the specified MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadMutatingWebhookConfigurationResponse`]`>` constructor, or [`ReadMutatingWebhookConfigurationResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the MutatingWebhookConfiguration + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`MutatingWebhookConfiguration::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadMutatingWebhookConfigurationResponse { + Ok(crate::api::admissionregistration::v1::MutatingWebhookConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadMutatingWebhookConfigurationResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadMutatingWebhookConfigurationResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadMutatingWebhookConfigurationResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// replace the specified MutatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the MutatingWebhookConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::admissionregistration::v1::MutatingWebhookConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAdmissionregistrationV1MutatingWebhookConfiguration + +impl MutatingWebhookConfiguration { + /// list or watch objects of kind MutatingWebhookConfiguration + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End admissionregistration.k8s.io/v1/MutatingWebhookConfiguration + +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::DeepMerge::merge_from(&mut self.webhooks, other.webhooks); + } +} + +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_25/api/admissionregistration/v1/rule_with_operations.rs b/src/v1_25/api/admissionregistration/v1/rule_with_operations.rs new file mode 100644 index 0000000000..c45c425c57 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.api_versions, other.api_versions); + crate::DeepMerge::merge_from(&mut self.operations, other.operations); + crate::DeepMerge::merge_from(&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_25/api/admissionregistration/v1/service_reference.rs b/src/v1_25/api/admissionregistration/v1/service_reference.rs new file mode 100644 index 0000000000..a3c392ec3f --- /dev/null +++ b/src/v1_25/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_25/api/admissionregistration/v1/validating_webhook.rs b/src/v1_25/api/admissionregistration/v1/validating_webhook.rs new file mode 100644 index 0000000000..1a64d4e885 --- /dev/null +++ b/src/v1_25/api/admissionregistration/v1/validating_webhook.rs @@ -0,0 +1,397 @@ +// 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, + + /// 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::DeepMerge::merge_from(&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::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.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_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, + "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_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_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_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", + "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_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_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() + }), + ), + ( + "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_25/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs new file mode 100644 index 0000000000..4c520b0eeb --- /dev/null +++ b/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -0,0 +1,560 @@ +// 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>, +} + +// Begin admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration + +// Generated from operation createAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// create a ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::admissionregistration::v1::ValidatingWebhookConfiguration, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAdmissionregistrationV1CollectionValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// delete collection of ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// delete a ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ValidatingWebhookConfiguration + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// list or watch objects of kind ValidatingWebhookConfiguration + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// partially update the specified ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ValidatingWebhookConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// read the specified ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingWebhookConfigurationResponse`]`>` constructor, or [`ReadValidatingWebhookConfigurationResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ValidatingWebhookConfiguration + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ValidatingWebhookConfiguration::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadValidatingWebhookConfigurationResponse { + Ok(crate::api::admissionregistration::v1::ValidatingWebhookConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadValidatingWebhookConfigurationResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadValidatingWebhookConfigurationResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadValidatingWebhookConfigurationResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// replace the specified ValidatingWebhookConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ValidatingWebhookConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::admissionregistration::v1::ValidatingWebhookConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAdmissionregistrationV1ValidatingWebhookConfiguration + +impl ValidatingWebhookConfiguration { + /// list or watch objects of kind ValidatingWebhookConfiguration + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration + +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::DeepMerge::merge_from(&mut self.webhooks, other.webhooks); + } +} + +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_25/api/admissionregistration/v1/webhook_client_config.rs b/src/v1_25/api/admissionregistration/v1/webhook_client_config.rs new file mode 100644 index 0000000000..e0adf4e461 --- /dev/null +++ b/src/v1_25/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_25/api/apiserverinternal/mod.rs b/src/v1_25/api/apiserverinternal/mod.rs new file mode 100644 index 0000000000..32a5a9d4fd --- /dev/null +++ b/src/v1_25/api/apiserverinternal/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha1; diff --git a/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs new file mode 100644 index 0000000000..28bc9cd304 --- /dev/null +++ b/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs @@ -0,0 +1,17 @@ + +mod server_storage_version; +pub use self::server_storage_version::ServerStorageVersion; + +mod storage_version; +pub use self::storage_version::StorageVersion; +#[cfg(feature = "api")] pub use self::storage_version::ReadStorageVersionResponse; +#[cfg(feature = "api")] pub use self::storage_version::ReadStorageVersionStatusResponse; + +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_25/api/apiserverinternal/v1alpha1/server_storage_version.rs b/src/v1_25/api/apiserverinternal/v1alpha1/server_storage_version.rs new file mode 100644 index 0000000000..1040b5e6d7 --- /dev/null +++ b/src/v1_25/api/apiserverinternal/v1alpha1/server_storage_version.rs @@ -0,0 +1,186 @@ +// 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, +} + +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::DeepMerge::merge_from(&mut self.decodable_versions, other.decodable_versions); + crate::DeepMerge::merge_from(&mut self.encoding_version, other.encoding_version); + } +} + +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, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> 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, + _ => 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; + + 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::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, + }) + } + } + + deserializer.deserialize_struct( + "ServerStorageVersion", + &[ + "apiServerID", + "decodableVersions", + "encodingVersion", + ], + 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), + )?; + 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)?; + } + 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() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs new file mode 100644 index 0000000000..c5d811a2fd --- /dev/null +++ b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs @@ -0,0 +1,730 @@ +// 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, +} + +// Begin internal.apiserver.k8s.io/v1alpha1/StorageVersion + +// Generated from operation createInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// create a StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::apiserverinternal::v1alpha1::StorageVersion, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/v1alpha1/storageversions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteInternalApiserverV1alpha1CollectionStorageVersion + +impl StorageVersion { + /// delete collection of StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/v1alpha1/storageversions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// delete a StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// list or watch objects of kind StorageVersion + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/v1alpha1/storageversions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// partially update the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchInternalApiserverV1alpha1StorageVersionStatus + +impl StorageVersion { + /// partially update status of the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// read the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStorageVersionResponse`]`>` constructor, or [`ReadStorageVersionResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`StorageVersion::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStorageVersionResponse { + Ok(crate::api::apiserverinternal::v1alpha1::StorageVersion), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStorageVersionResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStorageVersionResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStorageVersionResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readInternalApiserverV1alpha1StorageVersionStatus + +impl StorageVersion { + /// read status of the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStorageVersionStatusResponse`]`>` constructor, or [`ReadStorageVersionStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`StorageVersion::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStorageVersionStatusResponse { + Ok(crate::api::apiserverinternal::v1alpha1::StorageVersion), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStorageVersionStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStorageVersionStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStorageVersionStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// replace the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::apiserverinternal::v1alpha1::StorageVersion, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceInternalApiserverV1alpha1StorageVersionStatus + +impl StorageVersion { + /// replace status of the specified StorageVersion + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageVersion + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::apiserverinternal::v1alpha1::StorageVersion, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchInternalApiserverV1alpha1StorageVersion + +impl StorageVersion { + /// list or watch objects of kind StorageVersion + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/v1alpha1/storageversions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End internal.apiserver.k8s.io/v1alpha1/StorageVersion + +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_25/api/apiserverinternal/v1alpha1/storage_version_condition.rs b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_condition.rs new file mode 100644 index 0000000000..661d87dea2 --- /dev/null +++ b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_condition.rs @@ -0,0 +1,250 @@ +// 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: Option, + + /// 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, + 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", + 3 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.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)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + 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: [ + "reason".to_owned(), + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_spec.rs b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_spec.rs new file mode 100644 index 0000000000..316e626c88 --- /dev/null +++ b/src/v1_25/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_25/api/apiserverinternal/v1alpha1/storage_version_status.rs b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_status.rs new file mode 100644 index 0000000000..e63b469644 --- /dev/null +++ b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version_status.rs @@ -0,0 +1,185 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.storage_versions, other.storage_versions); + } +} + +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_25/api/apps/mod.rs b/src/v1_25/api/apps/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/apps/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/apps/v1/controller_revision.rs b/src/v1_25/api/apps/v1/controller_revision.rs new file mode 100644 index 0000000000..fa18bb2583 --- /dev/null +++ b/src/v1_25/api/apps/v1/controller_revision.rs @@ -0,0 +1,696 @@ +// 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, +} + +// Begin apps/v1/ControllerRevision + +// Generated from operation createAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// create a ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::apps::v1::ControllerRevision, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1CollectionNamespacedControllerRevision + +impl ControllerRevision { + /// delete collection of ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// delete a ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ControllerRevision + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1ControllerRevisionForAllNamespaces + +impl ControllerRevision { + /// list or watch objects of kind ControllerRevision + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/controllerrevisions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// list or watch objects of kind ControllerRevision + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// partially update the specified ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ControllerRevision + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// read the specified ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadControllerRevisionResponse`]`>` constructor, or [`ReadControllerRevisionResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ControllerRevision + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ControllerRevision::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadControllerRevisionResponse { + Ok(crate::api::apps::v1::ControllerRevision), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadControllerRevisionResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadControllerRevisionResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadControllerRevisionResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// replace the specified ControllerRevision + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ControllerRevision + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::ControllerRevision, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1ControllerRevisionForAllNamespaces + +impl ControllerRevision { + /// list or watch objects of kind ControllerRevision + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/controllerrevisions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1NamespacedControllerRevision + +impl ControllerRevision { + /// list or watch objects of kind ControllerRevision + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/controllerrevisions?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apps/v1/ControllerRevision + +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_25/api/apps/v1/daemon_set.rs b/src/v1_25/api/apps/v1/daemon_set.rs new file mode 100644 index 0000000000..6a782f979d --- /dev/null +++ b/src/v1_25/api/apps/v1/daemon_set.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin apps/v1/DaemonSet + +// Generated from operation createAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// create a DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::apps::v1::DaemonSet, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1CollectionNamespacedDaemonSet + +impl DaemonSet { + /// delete collection of DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// delete a DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1DaemonSetForAllNamespaces + +impl DaemonSet { + /// list or watch objects of kind DaemonSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/daemonsets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// list or watch objects of kind DaemonSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// partially update the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedDaemonSetStatus + +impl DaemonSet { + /// partially update status of the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// read the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadDaemonSetResponse`]`>` constructor, or [`ReadDaemonSetResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`DaemonSet::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadDaemonSetResponse { + Ok(crate::api::apps::v1::DaemonSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadDaemonSetResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadDaemonSetResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadDaemonSetResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedDaemonSetStatus + +impl DaemonSet { + /// read status of the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadDaemonSetStatusResponse`]`>` constructor, or [`ReadDaemonSetStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`DaemonSet::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadDaemonSetStatusResponse { + Ok(crate::api::apps::v1::DaemonSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadDaemonSetStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadDaemonSetStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadDaemonSetStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// replace the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::DaemonSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedDaemonSetStatus + +impl DaemonSet { + /// replace status of the specified DaemonSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the DaemonSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::DaemonSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1DaemonSetForAllNamespaces + +impl DaemonSet { + /// list or watch objects of kind DaemonSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/daemonsets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1NamespacedDaemonSet + +impl DaemonSet { + /// list or watch objects of kind DaemonSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/daemonsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apps/v1/DaemonSet + +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_25/api/apps/v1/daemon_set_condition.rs b/src/v1_25/api/apps/v1/daemon_set_condition.rs new file mode 100644 index 0000000000..087e927ffe --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/daemon_set_spec.rs b/src/v1_25/api/apps/v1/daemon_set_spec.rs new file mode 100644 index 0000000000..dfd333eb05 --- /dev/null +++ b/src/v1_25/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). 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). 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_25/api/apps/v1/daemon_set_status.rs b/src/v1_25/api/apps/v1/daemon_set_status.rs new file mode 100644 index 0000000000..278caf879c --- /dev/null +++ b/src/v1_25/api/apps/v1/daemon_set_status.rs @@ -0,0 +1,360 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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_25/api/apps/v1/daemon_set_update_strategy.rs b/src/v1_25/api/apps/v1/daemon_set_update_strategy.rs new file mode 100644 index 0000000000..1b67c9bd0f --- /dev/null +++ b/src/v1_25/api/apps/v1/daemon_set_update_strategy.rs @@ -0,0 +1,153 @@ +// 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.\n\n".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_25/api/apps/v1/deployment.rs b/src/v1_25/api/apps/v1/deployment.rs new file mode 100644 index 0000000000..f8d215b273 --- /dev/null +++ b/src/v1_25/api/apps/v1/deployment.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin apps/v1/Deployment + +// Generated from operation createAppsV1NamespacedDeployment + +impl Deployment { + /// create a Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::apps::v1::Deployment, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1CollectionNamespacedDeployment + +impl Deployment { + /// delete collection of Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1NamespacedDeployment + +impl Deployment { + /// delete a Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1DeploymentForAllNamespaces + +impl Deployment { + /// list or watch objects of kind Deployment + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/deployments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1NamespacedDeployment + +impl Deployment { + /// list or watch objects of kind Deployment + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedDeployment + +impl Deployment { + /// partially update the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedDeploymentStatus + +impl Deployment { + /// partially update status of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedDeployment + +impl Deployment { + /// read the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadDeploymentResponse`]`>` constructor, or [`ReadDeploymentResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Deployment::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadDeploymentResponse { + Ok(crate::api::apps::v1::Deployment), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadDeploymentResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadDeploymentResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadDeploymentResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedDeploymentStatus + +impl Deployment { + /// read status of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadDeploymentStatusResponse`]`>` constructor, or [`ReadDeploymentStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Deployment::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadDeploymentStatusResponse { + Ok(crate::api::apps::v1::Deployment), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadDeploymentStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadDeploymentStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadDeploymentStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedDeployment + +impl Deployment { + /// replace the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::Deployment, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedDeploymentStatus + +impl Deployment { + /// replace status of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Deployment + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::Deployment, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1DeploymentForAllNamespaces + +impl Deployment { + /// list or watch objects of kind Deployment + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/deployments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1NamespacedDeployment + +impl Deployment { + /// list or watch objects of kind Deployment + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apps/v1/Deployment + +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_25/api/apps/v1/deployment_condition.rs b/src/v1_25/api/apps/v1/deployment_condition.rs new file mode 100644 index 0000000000..637b9710ef --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/deployment_spec.rs b/src/v1_25/api/apps/v1/deployment_spec.rs new file mode 100644 index 0000000000..934282ed64 --- /dev/null +++ b/src/v1_25/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. + 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.".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_25/api/apps/v1/deployment_status.rs b/src/v1_25/api/apps/v1/deployment_status.rs new file mode 100644 index 0000000000..01ff5c75e4 --- /dev/null +++ b/src/v1_25/api/apps/v1/deployment_status.rs @@ -0,0 +1,313 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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_25/api/apps/v1/deployment_strategy.rs b/src/v1_25/api/apps/v1/deployment_strategy.rs new file mode 100644 index 0000000000..0f1edf93ab --- /dev/null +++ b/src/v1_25/api/apps/v1/deployment_strategy.rs @@ -0,0 +1,153 @@ +// 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.\n\n".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_25/api/apps/v1/mod.rs b/src/v1_25/api/apps/v1/mod.rs new file mode 100644 index 0000000000..9b0d98c82d --- /dev/null +++ b/src/v1_25/api/apps/v1/mod.rs @@ -0,0 +1,81 @@ + +mod controller_revision; +pub use self::controller_revision::ControllerRevision; +#[cfg(feature = "api")] pub use self::controller_revision::ReadControllerRevisionResponse; + +mod daemon_set; +pub use self::daemon_set::DaemonSet; +#[cfg(feature = "api")] pub use self::daemon_set::ReadDaemonSetResponse; +#[cfg(feature = "api")] pub use self::daemon_set::ReadDaemonSetStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::deployment::ReadDeploymentResponse; +#[cfg(feature = "api")] pub use self::deployment::ReadDeploymentStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::replica_set::ReadReplicaSetResponse; +#[cfg(feature = "api")] pub use self::replica_set::ReadReplicaSetStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::stateful_set::ReadStatefulSetResponse; +#[cfg(feature = "api")] pub use self::stateful_set::ReadStatefulSetStatusResponse; + +mod stateful_set_condition; +pub use self::stateful_set_condition::StatefulSetCondition; + +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_25/api/apps/v1/replica_set.rs b/src/v1_25/api/apps/v1/replica_set.rs new file mode 100644 index 0000000000..41a72f7b44 --- /dev/null +++ b/src/v1_25/api/apps/v1/replica_set.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin apps/v1/ReplicaSet + +// Generated from operation createAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// create a ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::apps::v1::ReplicaSet, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1CollectionNamespacedReplicaSet + +impl ReplicaSet { + /// delete collection of ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// delete a ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// list or watch objects of kind ReplicaSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1ReplicaSetForAllNamespaces + +impl ReplicaSet { + /// list or watch objects of kind ReplicaSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/replicasets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// partially update the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedReplicaSetStatus + +impl ReplicaSet { + /// partially update status of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// read the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicaSetResponse`]`>` constructor, or [`ReadReplicaSetResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ReplicaSet::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicaSetResponse { + Ok(crate::api::apps::v1::ReplicaSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicaSetResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicaSetResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicaSetResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedReplicaSetStatus + +impl ReplicaSet { + /// read status of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicaSetStatusResponse`]`>` constructor, or [`ReadReplicaSetStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ReplicaSet::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicaSetStatusResponse { + Ok(crate::api::apps::v1::ReplicaSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicaSetStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicaSetStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicaSetStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// replace the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::ReplicaSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedReplicaSetStatus + +impl ReplicaSet { + /// replace status of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicaSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::ReplicaSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1NamespacedReplicaSet + +impl ReplicaSet { + /// list or watch objects of kind ReplicaSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1ReplicaSetForAllNamespaces + +impl ReplicaSet { + /// list or watch objects of kind ReplicaSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/replicasets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apps/v1/ReplicaSet + +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_25/api/apps/v1/replica_set_condition.rs b/src/v1_25/api/apps/v1/replica_set_condition.rs new file mode 100644 index 0000000000..78cbdfa62f --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/replica_set_spec.rs b/src/v1_25/api/apps/v1/replica_set_spec.rs new file mode 100644 index 0000000000..19629aa779 --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/replica_set_status.rs b/src/v1_25/api/apps/v1/replica_set_status.rs new file mode 100644 index 0000000000..6b5b45e35f --- /dev/null +++ b/src/v1_25/api/apps/v1/replica_set_status.rs @@ -0,0 +1,262 @@ +// 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 oberved 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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 oberved 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_25/api/apps/v1/rolling_update_daemon_set.rs b/src/v1_25/api/apps/v1/rolling_update_daemon_set.rs new file mode 100644 index 0000000000..f520b116fc --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/rolling_update_deployment.rs b/src/v1_25/api/apps/v1/rolling_update_deployment.rs new file mode 100644 index 0000000000..84b6c04800 --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/rolling_update_stateful_set_strategy.rs b/src/v1_25/api/apps/v1/rolling_update_stateful_set_strategy.rs new file mode 100644 index 0000000000..a4e0688d0f --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/stateful_set.rs b/src/v1_25/api/apps/v1/stateful_set.rs new file mode 100644 index 0000000000..513df14954 --- /dev/null +++ b/src/v1_25/api/apps/v1/stateful_set.rs @@ -0,0 +1,872 @@ +// 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, +} + +// Begin apps/v1/StatefulSet + +// Generated from operation createAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// create a StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::apps::v1::StatefulSet, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1CollectionNamespacedStatefulSet + +impl StatefulSet { + /// delete collection of StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// delete a StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// list or watch objects of kind StatefulSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAppsV1StatefulSetForAllNamespaces + +impl StatefulSet { + /// list or watch objects of kind StatefulSet + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/statefulsets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// partially update the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedStatefulSetStatus + +impl StatefulSet { + /// partially update status of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// read the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStatefulSetResponse`]`>` constructor, or [`ReadStatefulSetResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`StatefulSet::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStatefulSetResponse { + Ok(crate::api::apps::v1::StatefulSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStatefulSetResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStatefulSetResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStatefulSetResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedStatefulSetStatus + +impl StatefulSet { + /// read status of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStatefulSetStatusResponse`]`>` constructor, or [`ReadStatefulSetStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`StatefulSet::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStatefulSetStatusResponse { + Ok(crate::api::apps::v1::StatefulSet), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStatefulSetStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStatefulSetStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStatefulSetStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// replace the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::StatefulSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedStatefulSetStatus + +impl StatefulSet { + /// replace status of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StatefulSet + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::apps::v1::StatefulSet, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1NamespacedStatefulSet + +impl StatefulSet { + /// list or watch objects of kind StatefulSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAppsV1StatefulSetForAllNamespaces + +impl StatefulSet { + /// list or watch objects of kind StatefulSet + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apps/v1/statefulsets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apps/v1/StatefulSet + +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_25/api/apps/v1/stateful_set_condition.rs b/src/v1_25/api/apps/v1/stateful_set_condition.rs new file mode 100644 index 0000000000..1463e6a796 --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/stateful_set_persistent_volume_claim_retention_policy.rs b/src/v1_25/api/apps/v1/stateful_set_persistent_volume_claim_retention_policy.rs new file mode 100644 index 0000000000..90c5533d1e --- /dev/null +++ b/src/v1_25/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_25/api/apps/v1/stateful_set_spec.rs b/src/v1_25/api/apps/v1/stateful_set_spec.rs new file mode 100644 index 0000000000..001ccc054b --- /dev/null +++ b/src/v1_25/api/apps/v1/stateful_set_spec.rs @@ -0,0 +1,357 @@ +// 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, + + /// 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. + 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.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::DeepMerge::merge_from(&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_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, + "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_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_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, + 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", + "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.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.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() + }), + ), + ( + "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.\n\n".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.".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_25/api/apps/v1/stateful_set_status.rs b/src/v1_25/api/apps/v1/stateful_set_status.rs new file mode 100644 index 0000000000..74b5517785 --- /dev/null +++ b/src/v1_25/api/apps/v1/stateful_set_status.rs @@ -0,0 +1,364 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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_25/api/apps/v1/stateful_set_update_strategy.rs b/src/v1_25/api/apps/v1/stateful_set_update_strategy.rs new file mode 100644 index 0000000000..1fa0f9d149 --- /dev/null +++ b/src/v1_25/api/apps/v1/stateful_set_update_strategy.rs @@ -0,0 +1,153 @@ +// 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.\n\n".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_25/api/authentication/mod.rs b/src/v1_25/api/authentication/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/authentication/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/authentication/v1/bound_object_reference.rs b/src/v1_25/api/authentication/v1/bound_object_reference.rs new file mode 100644 index 0000000000..024af1efc2 --- /dev/null +++ b/src/v1_25/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_25/api/authentication/v1/mod.rs b/src/v1_25/api/authentication/v1/mod.rs new file mode 100644 index 0000000000..b50b30c7ad --- /dev/null +++ b/src/v1_25/api/authentication/v1/mod.rs @@ -0,0 +1,24 @@ + +mod bound_object_reference; +pub use self::bound_object_reference::BoundObjectReference; + +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_25/api/authentication/v1/token_request.rs b/src/v1_25/api/authentication/v1/token_request.rs new file mode 100644 index 0000000000..1f864e2ac3 --- /dev/null +++ b/src/v1_25/api/authentication/v1/token_request.rs @@ -0,0 +1,290 @@ +// 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, +} + +// Begin authentication.k8s.io/v1/TokenRequest + +// Generated from operation createCoreV1NamespacedServiceAccountToken + +impl TokenRequest { + /// create token of a ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the TokenRequest + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create_service_account_token( + name: &str, + namespace: &str, + body: &crate::api::authentication::v1::TokenRequest, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts/{name}/token?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authentication.k8s.io/v1/TokenRequest + +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_25/api/authentication/v1/token_request_spec.rs b/src/v1_25/api/authentication/v1/token_request_spec.rs new file mode 100644 index 0000000000..6d4399ce6c --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/authentication/v1/token_request_status.rs b/src/v1_25/api/authentication/v1/token_request_status.rs new file mode 100644 index 0000000000..8e2f15a507 --- /dev/null +++ b/src/v1_25/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_25/api/authentication/v1/token_review.rs b/src/v1_25/api/authentication/v1/token_review.rs new file mode 100644 index 0000000000..e4ed490482 --- /dev/null +++ b/src/v1_25/api/authentication/v1/token_review.rs @@ -0,0 +1,277 @@ +// 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, +} + +// Begin authentication.k8s.io/v1/TokenReview + +// Generated from operation createAuthenticationV1TokenReview + +impl TokenReview { + /// create a TokenReview + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::authentication::v1::TokenReview, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/authentication.k8s.io/v1/tokenreviews?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authentication.k8s.io/v1/TokenReview + +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_25/api/authentication/v1/token_review_spec.rs b/src/v1_25/api/authentication/v1/token_review_spec.rs new file mode 100644 index 0000000000..fd84653924 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/authentication/v1/token_review_status.rs b/src/v1_25/api/authentication/v1/token_review_status.rs new file mode 100644 index 0000000000..464164bcf9 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/authentication/v1/user_info.rs b/src/v1_25/api/authentication/v1/user_info.rs new file mode 100644 index 0000000000..d6890119b7 --- /dev/null +++ b/src/v1_25/api/authentication/v1/user_info.rs @@ -0,0 +1,229 @@ +// 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::DeepMerge::merge_from(&mut self.extra, other.extra); + crate::DeepMerge::merge_from(&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_25/api/authorization/mod.rs b/src/v1_25/api/authorization/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/authorization/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/authorization/v1/local_subject_access_review.rs b/src/v1_25/api/authorization/v1/local_subject_access_review.rs new file mode 100644 index 0000000000..53e620a9f8 --- /dev/null +++ b/src/v1_25/api/authorization/v1/local_subject_access_review.rs @@ -0,0 +1,284 @@ +// 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, +} + +// Begin authorization.k8s.io/v1/LocalSubjectAccessReview + +// Generated from operation createAuthorizationV1NamespacedLocalSubjectAccessReview + +impl LocalSubjectAccessReview { + /// create a LocalSubjectAccessReview + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::authorization::v1::LocalSubjectAccessReview, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviews?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authorization.k8s.io/v1/LocalSubjectAccessReview + +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_25/api/authorization/v1/mod.rs b/src/v1_25/api/authorization/v1/mod.rs new file mode 100644 index 0000000000..ee4f9cc0fb --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/non_resource_attributes.rs b/src/v1_25/api/authorization/v1/non_resource_attributes.rs new file mode 100644 index 0000000000..4a4a284d7c --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/non_resource_rule.rs b/src/v1_25/api/authorization/v1/non_resource_rule.rs new file mode 100644 index 0000000000..7df269ffd7 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.non_resource_urls, other.non_resource_urls); + crate::DeepMerge::merge_from(&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_25/api/authorization/v1/resource_attributes.rs b/src/v1_25/api/authorization/v1/resource_attributes.rs new file mode 100644 index 0000000000..42bd58da48 --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/resource_rule.rs b/src/v1_25/api/authorization/v1/resource_rule.rs new file mode 100644 index 0000000000..58b5e020a8 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.resource_names, other.resource_names); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&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_25/api/authorization/v1/self_subject_access_review.rs b/src/v1_25/api/authorization/v1/self_subject_access_review.rs new file mode 100644 index 0000000000..bf549beb13 --- /dev/null +++ b/src/v1_25/api/authorization/v1/self_subject_access_review.rs @@ -0,0 +1,277 @@ +// 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, +} + +// Begin authorization.k8s.io/v1/SelfSubjectAccessReview + +// Generated from operation createAuthorizationV1SelfSubjectAccessReview + +impl SelfSubjectAccessReview { + /// create a SelfSubjectAccessReview + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::authorization::v1::SelfSubjectAccessReview, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/authorization.k8s.io/v1/selfsubjectaccessreviews?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authorization.k8s.io/v1/SelfSubjectAccessReview + +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_25/api/authorization/v1/self_subject_access_review_spec.rs b/src/v1_25/api/authorization/v1/self_subject_access_review_spec.rs new file mode 100644 index 0000000000..dab5aba82c --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/self_subject_rules_review.rs b/src/v1_25/api/authorization/v1/self_subject_rules_review.rs new file mode 100644 index 0000000000..60defd6f35 --- /dev/null +++ b/src/v1_25/api/authorization/v1/self_subject_rules_review.rs @@ -0,0 +1,277 @@ +// 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, +} + +// Begin authorization.k8s.io/v1/SelfSubjectRulesReview + +// Generated from operation createAuthorizationV1SelfSubjectRulesReview + +impl SelfSubjectRulesReview { + /// create a SelfSubjectRulesReview + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::authorization::v1::SelfSubjectRulesReview, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authorization.k8s.io/v1/SelfSubjectRulesReview + +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_25/api/authorization/v1/self_subject_rules_review_spec.rs b/src/v1_25/api/authorization/v1/self_subject_rules_review_spec.rs new file mode 100644 index 0000000000..087406a4f7 --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/subject_access_review.rs b/src/v1_25/api/authorization/v1/subject_access_review.rs new file mode 100644 index 0000000000..8735a9f0bc --- /dev/null +++ b/src/v1_25/api/authorization/v1/subject_access_review.rs @@ -0,0 +1,277 @@ +// 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, +} + +// Begin authorization.k8s.io/v1/SubjectAccessReview + +// Generated from operation createAuthorizationV1SubjectAccessReview + +impl SubjectAccessReview { + /// create a SubjectAccessReview + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::authorization::v1::SubjectAccessReview, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/authorization.k8s.io/v1/subjectaccessreviews?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End authorization.k8s.io/v1/SubjectAccessReview + +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_25/api/authorization/v1/subject_access_review_spec.rs b/src/v1_25/api/authorization/v1/subject_access_review_spec.rs new file mode 100644 index 0000000000..ae8fadafd9 --- /dev/null +++ b/src/v1_25/api/authorization/v1/subject_access_review_spec.rs @@ -0,0 +1,279 @@ +// 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::DeepMerge::merge_from(&mut self.extra, other.extra); + crate::DeepMerge::merge_from(&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_25/api/authorization/v1/subject_access_review_status.rs b/src/v1_25/api/authorization/v1/subject_access_review_status.rs new file mode 100644 index 0000000000..14a41ecc52 --- /dev/null +++ b/src/v1_25/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_25/api/authorization/v1/subject_rules_review_status.rs b/src/v1_25/api/authorization/v1/subject_rules_review_status.rs new file mode 100644 index 0000000000..9d7fb042cf --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.non_resource_rules, other.non_resource_rules); + crate::DeepMerge::merge_from(&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_25/api/autoscaling/mod.rs b/src/v1_25/api/autoscaling/mod.rs new file mode 100644 index 0000000000..113f9836b7 --- /dev/null +++ b/src/v1_25/api/autoscaling/mod.rs @@ -0,0 +1,5 @@ +pub mod v1; + +pub mod v2; + +pub mod v2beta2; diff --git a/src/v1_25/api/autoscaling/v1/cross_version_object_reference.rs b/src/v1_25/api/autoscaling/v1/cross_version_object_reference.rs new file mode 100644 index 0000000000..4cb70e6c7d --- /dev/null +++ b/src/v1_25/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 { + /// API version of the referent + pub api_version: 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: http://kubernetes.io/docs/user-guide/identifiers#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("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; 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: http://kubernetes.io/docs/user-guide/identifiers#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_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs new file mode 100644 index 0000000000..01ee0ebcfc --- /dev/null +++ b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -0,0 +1,868 @@ +// 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, + + /// behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + pub spec: Option, + + /// current information about the autoscaler. + pub status: Option, +} + +// Begin autoscaling/v1/HorizontalPodAutoscaler + +// Generated from operation createAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// create a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::autoscaling::v1::HorizontalPodAutoscaler, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV1CollectionNamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete collection of HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV1HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v1/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// partially update the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV1NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// partially update status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// read the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerResponse { + Ok(crate::api::autoscaling::v1::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAutoscalingV1NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// read status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerStatusResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerStatusResponse { + Ok(crate::api::autoscaling::v1::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// replace the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAutoscalingV1NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// replace status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV1HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v1/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV1NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End autoscaling/v1/HorizontalPodAutoscaler + +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("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("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_25/api/autoscaling/v1/horizontal_pod_autoscaler_spec.rs b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler_spec.rs new file mode 100644 index 0000000000..fa7fad5681 --- /dev/null +++ b/src/v1_25/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 { + /// 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, + + /// 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("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("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_25/api/autoscaling/v1/horizontal_pod_autoscaler_status.rs b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler_status.rs new file mode 100644 index 0000000000..4959ee8e2e --- /dev/null +++ b/src/v1_25/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 { + /// 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, + + /// current number of replicas of pods managed by this autoscaler. + pub current_replicas: i32, + + /// desired number of replicas of pods managed by this autoscaler. + pub desired_replicas: i32, + + /// 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, + + /// 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("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("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("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("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("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_25/api/autoscaling/v1/mod.rs b/src/v1_25/api/autoscaling/v1/mod.rs new file mode 100644 index 0000000000..d2b01e62d7 --- /dev/null +++ b/src/v1_25/api/autoscaling/v1/mod.rs @@ -0,0 +1,27 @@ + +mod cross_version_object_reference; +pub use self::cross_version_object_reference::CrossVersionObjectReference; + +mod horizontal_pod_autoscaler; +pub use self::horizontal_pod_autoscaler::HorizontalPodAutoscaler; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerResponse; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::scale::ReadDeploymentScaleResponse; +#[cfg(feature = "api")] pub use self::scale::ReadReplicaSetScaleResponse; +#[cfg(feature = "api")] pub use self::scale::ReadStatefulSetScaleResponse; +#[cfg(feature = "api")] pub use self::scale::ReadReplicationControllerScaleResponse; + +mod scale_spec; +pub use self::scale_spec::ScaleSpec; + +mod scale_status; +pub use self::scale_status::ScaleStatus; diff --git a/src/v1_25/api/autoscaling/v1/scale.rs b/src/v1_25/api/autoscaling/v1/scale.rs new file mode 100644 index 0000000000..89a7024529 --- /dev/null +++ b/src/v1_25/api/autoscaling/v1/scale.rs @@ -0,0 +1,929 @@ +// 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, + + /// 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, + + /// 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, +} + +// Begin autoscaling/v1/Scale + +// Generated from operation patchAppsV1NamespacedDeploymentScale + +impl Scale { + /// partially update scale of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_deployment( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedReplicaSetScale + +impl Scale { + /// partially update scale of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_replica_set( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAppsV1NamespacedStatefulSetScale + +impl Scale { + /// partially update scale of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_stateful_set( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedReplicationControllerScale + +impl Scale { + /// partially update scale of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_replication_controller( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAppsV1NamespacedDeploymentScale + +impl Scale { + /// read scale of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadDeploymentScaleResponse`]`>` constructor, or [`ReadDeploymentScaleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_deployment( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Scale::read_deployment`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadDeploymentScaleResponse { + Ok(crate::api::autoscaling::v1::Scale), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadDeploymentScaleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadDeploymentScaleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadDeploymentScaleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedReplicaSetScale + +impl Scale { + /// read scale of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicaSetScaleResponse`]`>` constructor, or [`ReadReplicaSetScaleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_replica_set( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Scale::read_replica_set`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicaSetScaleResponse { + Ok(crate::api::autoscaling::v1::Scale), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicaSetScaleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicaSetScaleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicaSetScaleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAppsV1NamespacedStatefulSetScale + +impl Scale { + /// read scale of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStatefulSetScaleResponse`]`>` constructor, or [`ReadStatefulSetScaleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_stateful_set( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Scale::read_stateful_set`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStatefulSetScaleResponse { + Ok(crate::api::autoscaling::v1::Scale), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStatefulSetScaleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStatefulSetScaleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStatefulSetScaleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedReplicationControllerScale + +impl Scale { + /// read scale of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicationControllerScaleResponse`]`>` constructor, or [`ReadReplicationControllerScaleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_replication_controller( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Scale::read_replication_controller`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicationControllerScaleResponse { + Ok(crate::api::autoscaling::v1::Scale), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicationControllerScaleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicationControllerScaleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicationControllerScaleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAppsV1NamespacedDeploymentScale + +impl Scale { + /// replace scale of the specified Deployment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_deployment( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::Scale, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedReplicaSetScale + +impl Scale { + /// replace scale of the specified ReplicaSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_replica_set( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::Scale, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAppsV1NamespacedStatefulSetScale + +impl Scale { + /// replace scale of the specified StatefulSet + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_stateful_set( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::Scale, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedReplicationControllerScale + +impl Scale { + /// replace scale of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Scale + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_replication_controller( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v1::Scale, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End autoscaling/v1/Scale + +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("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("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_25/api/autoscaling/v1/scale_spec.rs b/src/v1_25/api/autoscaling/v1/scale_spec.rs new file mode 100644 index 0000000000..ff445f788c --- /dev/null +++ b/src/v1_25/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 { + /// 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("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_25/api/autoscaling/v1/scale_status.rs b/src/v1_25/api/autoscaling/v1/scale_status.rs new file mode 100644 index 0000000000..18113218a8 --- /dev/null +++ b/src/v1_25/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 { + /// actual number of observed instances of the scaled object. + pub replicas: i32, + + /// 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: http://kubernetes.io/docs/user-guide/labels#label-selectors + 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("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("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: http://kubernetes.io/docs/user-guide/labels#label-selectors".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_25/api/autoscaling/v2/container_resource_metric_source.rs b/src/v1_25/api/autoscaling/v2/container_resource_metric_source.rs new file mode 100644 index 0000000000..f429b7a15b --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/container_resource_metric_status.rs b/src/v1_25/api/autoscaling/v2/container_resource_metric_status.rs new file mode 100644 index 0000000000..e429b21ddb --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/cross_version_object_reference.rs b/src/v1_25/api/autoscaling/v2/cross_version_object_reference.rs new file mode 100644 index 0000000000..af8ab67c04 --- /dev/null +++ b/src/v1_25/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 { + /// API version of the referent + pub api_version: 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: http://kubernetes.io/docs/user-guide/identifiers#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("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; 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: http://kubernetes.io/docs/user-guide/identifiers#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_25/api/autoscaling/v2/external_metric_source.rs b/src/v1_25/api/autoscaling/v2/external_metric_source.rs new file mode 100644 index 0000000000..35ca73057e --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/external_metric_status.rs b/src/v1_25/api/autoscaling/v2/external_metric_status.rs new file mode 100644 index 0000000000..af69d9d653 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs new file mode 100644 index 0000000000..e3df4c800c --- /dev/null +++ b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin autoscaling/v2/HorizontalPodAutoscaler + +// Generated from operation createAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// create a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::autoscaling::v2::HorizontalPodAutoscaler, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV2CollectionNamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete collection of HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV2HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v2/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// partially update the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// partially update status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// read the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerResponse { + Ok(crate::api::autoscaling::v2::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAutoscalingV2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// read status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerStatusResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerStatusResponse { + Ok(crate::api::autoscaling::v2::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// replace the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v2::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAutoscalingV2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// replace status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v2::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV2HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v2/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End autoscaling/v2/HorizontalPodAutoscaler + +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_25/api/autoscaling/v2/horizontal_pod_autoscaler_behavior.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler_behavior.rs new file mode 100644 index 0000000000..dade1c58b4 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/horizontal_pod_autoscaler_condition.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler_condition.rs new file mode 100644 index 0000000000..14eaa48ec2 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/horizontal_pod_autoscaler_spec.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler_spec.rs new file mode 100644 index 0000000000..90ea12126f --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs new file mode 100644 index 0000000000..bfb877a856 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs @@ -0,0 +1,264 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&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_25/api/autoscaling/v2/hpa_scaling_policy.rs b/src/v1_25/api/autoscaling/v2/hpa_scaling_policy.rs new file mode 100644 index 0000000000..75a2429f94 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/hpa_scaling_rules.rs b/src/v1_25/api/autoscaling/v2/hpa_scaling_rules.rs new file mode 100644 index 0000000000..0b0dc2c81d --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/autoscaling/v2/metric_identifier.rs b/src/v1_25/api/autoscaling/v2/metric_identifier.rs new file mode 100644 index 0000000000..09496c02c6 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/metric_spec.rs b/src/v1_25/api/autoscaling/v2/metric_spec.rs new file mode 100644 index 0000000000..d370e3eae8 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/metric_status.rs b/src/v1_25/api/autoscaling/v2/metric_status.rs new file mode 100644 index 0000000000..90f500d64d --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/metric_target.rs b/src/v1_25/api/autoscaling/v2/metric_target.rs new file mode 100644 index 0000000000..dd73037182 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/metric_value_status.rs b/src/v1_25/api/autoscaling/v2/metric_value_status.rs new file mode 100644 index 0000000000..816cdef6a1 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/mod.rs b/src/v1_25/api/autoscaling/v2/mod.rs new file mode 100644 index 0000000000..3f5b00bce4 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2/mod.rs @@ -0,0 +1,71 @@ + +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; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerResponse; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerStatusResponse; + +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_25/api/autoscaling/v2/object_metric_source.rs b/src/v1_25/api/autoscaling/v2/object_metric_source.rs new file mode 100644 index 0000000000..e1a8ef047f --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/object_metric_status.rs b/src/v1_25/api/autoscaling/v2/object_metric_status.rs new file mode 100644 index 0000000000..2e0f25d3d1 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/pods_metric_source.rs b/src/v1_25/api/autoscaling/v2/pods_metric_source.rs new file mode 100644 index 0000000000..d94f92df67 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/pods_metric_status.rs b/src/v1_25/api/autoscaling/v2/pods_metric_status.rs new file mode 100644 index 0000000000..8d903c7454 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/resource_metric_source.rs b/src/v1_25/api/autoscaling/v2/resource_metric_source.rs new file mode 100644 index 0000000000..6c5423aff9 --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2/resource_metric_status.rs b/src/v1_25/api/autoscaling/v2/resource_metric_status.rs new file mode 100644 index 0000000000..39747c8d2e --- /dev/null +++ b/src/v1_25/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_25/api/autoscaling/v2beta2/container_resource_metric_source.rs b/src/v1_25/api/autoscaling/v2beta2/container_resource_metric_source.rs new file mode 100644 index 0000000000..16f8768bc7 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/container_resource_metric_source.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/container_resource_metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/container_resource_metric_status.rs new file mode 100644 index 0000000000..2d7e39fab6 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/container_resource_metric_status.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/cross_version_object_reference.rs b/src/v1_25/api/autoscaling/v2beta2/cross_version_object_reference.rs new file mode 100644 index 0000000000..114e81013d --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/cross_version_object_reference.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference + +/// CrossVersionObjectReference contains enough information to let you identify the referred resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CrossVersionObjectReference { + /// API version of the referent + pub api_version: 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: http://kubernetes.io/docs/user-guide/identifiers#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.v2beta2.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("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; 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: http://kubernetes.io/docs/user-guide/identifiers#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_25/api/autoscaling/v2beta2/external_metric_source.rs b/src/v1_25/api/autoscaling/v2beta2/external_metric_source.rs new file mode 100644 index 0000000000..6399a71d36 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/external_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/external_metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/external_metric_status.rs new file mode 100644 index 0000000000..69a2150b53 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/external_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::MetricValueStatus, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs new file mode 100644 index 0000000000..df7124afd7 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -0,0 +1,868 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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, +} + +// Begin autoscaling/v2beta2/HorizontalPodAutoscaler + +// Generated from operation createAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// create a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::autoscaling::v2beta2::HorizontalPodAutoscaler, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV2beta2CollectionNamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete collection of HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// delete a HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV2beta2HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v2beta2/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// partially update the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchAutoscalingV2beta2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// partially update status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// read the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerResponse { + Ok(crate::api::autoscaling::v2beta2::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readAutoscalingV2beta2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// read status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadHorizontalPodAutoscalerStatusResponse`]`>` constructor, or [`ReadHorizontalPodAutoscalerStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`HorizontalPodAutoscaler::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadHorizontalPodAutoscalerStatusResponse { + Ok(crate::api::autoscaling::v2beta2::HorizontalPodAutoscaler), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadHorizontalPodAutoscalerStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadHorizontalPodAutoscalerStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// replace the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v2beta2::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceAutoscalingV2beta2NamespacedHorizontalPodAutoscalerStatus + +impl HorizontalPodAutoscaler { + /// replace status of the specified HorizontalPodAutoscaler + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the HorizontalPodAutoscaler + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::autoscaling::v2beta2::HorizontalPodAutoscaler, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV2beta2HorizontalPodAutoscalerForAllNamespaces + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/autoscaling/v2beta2/horizontalpodautoscalers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchAutoscalingV2beta2NamespacedHorizontalPodAutoscaler + +impl HorizontalPodAutoscaler { + /// list or watch objects of kind HorizontalPodAutoscaler + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End autoscaling/v2beta2/HorizontalPodAutoscaler + +impl crate::Resource for HorizontalPodAutoscaler { + const API_VERSION: &'static str = "autoscaling/v2beta2"; + const GROUP: &'static str = "autoscaling"; + const KIND: &'static str = "HorizontalPodAutoscaler"; + const VERSION: &'static str = "v2beta2"; + 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.v2beta2.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_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_behavior.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_behavior.rs new file mode 100644 index 0000000000..aa1001bc81 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_behavior.rs @@ -0,0 +1,155 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_condition.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_condition.rs new file mode 100644 index 0000000000..9f3f192edd --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_spec.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_spec.rs new file mode 100644 index 0000000000..c529e49162 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_spec.rs @@ -0,0 +1,232 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::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::DeepMerge::merge_from(&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.v2beta2.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_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_status.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_status.rs new file mode 100644 index 0000000000..176ea55941 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler_status.rs @@ -0,0 +1,262 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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: i32, + + /// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&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.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", + &[ + "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", + 2 + + self.conditions.as_ref().map_or(0, |_| 1) + + self.current_metrics.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)?; + } + 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.v2beta2.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: [ + "currentReplicas".to_owned(), + "desiredReplicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/autoscaling/v2beta2/hpa_scaling_policy.rs b/src/v1_25/api/autoscaling/v2beta2/hpa_scaling_policy.rs new file mode 100644 index 0000000000..e3e633604a --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/hpa_scaling_policy.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/hpa_scaling_rules.rs b/src/v1_25/api/autoscaling/v2beta2/hpa_scaling_rules.rs new file mode 100644 index 0000000000..3b62f0dd91 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/hpa_scaling_rules.rs @@ -0,0 +1,182 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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 MaxPolicySelect 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::DeepMerge::merge_from(&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.v2beta2.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 MaxPolicySelect 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_25/api/autoscaling/v2beta2/metric_identifier.rs b/src/v1_25/api/autoscaling/v2beta2/metric_identifier.rs new file mode 100644 index 0000000000..641093da02 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/metric_identifier.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/metric_spec.rs b/src/v1_25/api/autoscaling/v2beta2/metric_spec.rs new file mode 100644 index 0000000000..8beaf0c6d6 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/metric_spec.rs @@ -0,0 +1,253 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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 { + /// 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 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.v2beta2.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("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 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_25/api/autoscaling/v2beta2/metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/metric_status.rs new file mode 100644 index 0000000000..dbeb767cc0 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/metric_status.rs @@ -0,0 +1,253 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/metric_target.rs b/src/v1_25/api/autoscaling/v2beta2/metric_target.rs new file mode 100644 index 0000000000..d698efcd87 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/metric_target.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/metric_value_status.rs b/src/v1_25/api/autoscaling/v2beta2/metric_value_status.rs new file mode 100644 index 0000000000..6009fe0abb --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/metric_value_status.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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.v2beta2.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_25/api/autoscaling/v2beta2/mod.rs b/src/v1_25/api/autoscaling/v2beta2/mod.rs new file mode 100644 index 0000000000..3f5b00bce4 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/mod.rs @@ -0,0 +1,71 @@ + +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; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerResponse; +#[cfg(feature = "api")] pub use self::horizontal_pod_autoscaler::ReadHorizontalPodAutoscalerStatusResponse; + +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_25/api/autoscaling/v2beta2/object_metric_source.rs b/src/v1_25/api/autoscaling/v2beta2/object_metric_source.rs new file mode 100644 index 0000000000..69b6e8d2bc --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/object_metric_source.rs @@ -0,0 +1,166 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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 { + pub described_object: crate::api::autoscaling::v2beta2::CrossVersionObjectReference, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2beta2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2beta2::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.v2beta2.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(), + __gen.subschema_for::(), + ), + ( + "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_25/api/autoscaling/v2beta2/object_metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/object_metric_status.rs new file mode 100644 index 0000000000..78500f8993 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/object_metric_status.rs @@ -0,0 +1,166 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::MetricValueStatus, + + pub described_object: crate::api::autoscaling::v2beta2::CrossVersionObjectReference, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2beta2::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.v2beta2.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(), + __gen.subschema_for::(), + ), + ( + "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_25/api/autoscaling/v2beta2/pods_metric_source.rs b/src/v1_25/api/autoscaling/v2beta2/pods_metric_source.rs new file mode 100644 index 0000000000..fc42889c96 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/pods_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/pods_metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/pods_metric_status.rs new file mode 100644 index 0000000000..ba0cc5c9c3 --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/pods_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::MetricValueStatus, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/resource_metric_source.rs b/src/v1_25/api/autoscaling/v2beta2/resource_metric_source.rs new file mode 100644 index 0000000000..01af528bcc --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/resource_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::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.v2beta2.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_25/api/autoscaling/v2beta2/resource_metric_status.rs b/src/v1_25/api/autoscaling/v2beta2/resource_metric_status.rs new file mode 100644 index 0000000000..0b36fa44ba --- /dev/null +++ b/src/v1_25/api/autoscaling/v2beta2/resource_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2beta2.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::v2beta2::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.v2beta2.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_25/api/batch/mod.rs b/src/v1_25/api/batch/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/batch/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/batch/v1/cron_job.rs b/src/v1_25/api/batch/v1/cron_job.rs new file mode 100644 index 0000000000..7d5e4f4f63 --- /dev/null +++ b/src/v1_25/api/batch/v1/cron_job.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin batch/v1/CronJob + +// Generated from operation createBatchV1NamespacedCronJob + +impl CronJob { + /// create a CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::batch::v1::CronJob, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteBatchV1CollectionNamespacedCronJob + +impl CronJob { + /// delete collection of CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteBatchV1NamespacedCronJob + +impl CronJob { + /// delete a CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listBatchV1CronJobForAllNamespaces + +impl CronJob { + /// list or watch objects of kind CronJob + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/batch/v1/cronjobs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listBatchV1NamespacedCronJob + +impl CronJob { + /// list or watch objects of kind CronJob + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchBatchV1NamespacedCronJob + +impl CronJob { + /// partially update the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchBatchV1NamespacedCronJobStatus + +impl CronJob { + /// partially update status of the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readBatchV1NamespacedCronJob + +impl CronJob { + /// read the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCronJobResponse`]`>` constructor, or [`ReadCronJobResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CronJob::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCronJobResponse { + Ok(crate::api::batch::v1::CronJob), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCronJobResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCronJobResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCronJobResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readBatchV1NamespacedCronJobStatus + +impl CronJob { + /// read status of the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCronJobStatusResponse`]`>` constructor, or [`ReadCronJobStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CronJob::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCronJobStatusResponse { + Ok(crate::api::batch::v1::CronJob), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCronJobStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCronJobStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCronJobStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceBatchV1NamespacedCronJob + +impl CronJob { + /// replace the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::batch::v1::CronJob, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceBatchV1NamespacedCronJobStatus + +impl CronJob { + /// replace status of the specified CronJob + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CronJob + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::batch::v1::CronJob, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchBatchV1CronJobForAllNamespaces + +impl CronJob { + /// list or watch objects of kind CronJob + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/batch/v1/cronjobs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchBatchV1NamespacedCronJob + +impl CronJob { + /// list or watch objects of kind CronJob + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/cronjobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End batch/v1/CronJob + +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_25/api/batch/v1/cron_job_spec.rs b/src/v1_25/api/batch/v1/cron_job_spec.rs new file mode 100644 index 0000000000..3af3c4b3b9 --- /dev/null +++ b/src/v1_25/api/batch/v1/cron_job_spec.rs @@ -0,0 +1,305 @@ +// 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 This is beta field and must be enabled via the `CronJobTimeZone` feature gate. + 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: - \"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\n\n".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 This is beta field and must be enabled via the `CronJobTimeZone` feature gate.".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_25/api/batch/v1/cron_job_status.rs b/src/v1_25/api/batch/v1/cron_job_status.rs new file mode 100644 index 0000000000..cbd83e8fcd --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/batch/v1/job.rs b/src/v1_25/api/batch/v1/job.rs new file mode 100644 index 0000000000..255eab956e --- /dev/null +++ b/src/v1_25/api/batch/v1/job.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin batch/v1/Job + +// Generated from operation createBatchV1NamespacedJob + +impl Job { + /// create a Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::batch::v1::Job, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteBatchV1CollectionNamespacedJob + +impl Job { + /// delete collection of Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteBatchV1NamespacedJob + +impl Job { + /// delete a Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listBatchV1JobForAllNamespaces + +impl Job { + /// list or watch objects of kind Job + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/batch/v1/jobs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listBatchV1NamespacedJob + +impl Job { + /// list or watch objects of kind Job + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchBatchV1NamespacedJob + +impl Job { + /// partially update the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchBatchV1NamespacedJobStatus + +impl Job { + /// partially update status of the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readBatchV1NamespacedJob + +impl Job { + /// read the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadJobResponse`]`>` constructor, or [`ReadJobResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Job::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadJobResponse { + Ok(crate::api::batch::v1::Job), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadJobResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadJobResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadJobResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readBatchV1NamespacedJobStatus + +impl Job { + /// read status of the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadJobStatusResponse`]`>` constructor, or [`ReadJobStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Job::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadJobStatusResponse { + Ok(crate::api::batch::v1::Job), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadJobStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadJobStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadJobStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceBatchV1NamespacedJob + +impl Job { + /// replace the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::batch::v1::Job, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceBatchV1NamespacedJobStatus + +impl Job { + /// replace status of the specified Job + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Job + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::batch::v1::Job, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchBatchV1JobForAllNamespaces + +impl Job { + /// list or watch objects of kind Job + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/batch/v1/jobs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchBatchV1NamespacedJob + +impl Job { + /// list or watch objects of kind Job + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/batch/v1/namespaces/{namespace}/jobs?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End batch/v1/Job + +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_25/api/batch/v1/job_condition.rs b/src/v1_25/api/batch/v1/job_condition.rs new file mode 100644 index 0000000000..456f2b3dba --- /dev/null +++ b/src/v1_25/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_25/api/batch/v1/job_spec.rs b/src/v1_25/api/batch/v1/job_spec.rs new file mode 100644 index 0000000000..55acb684c2 --- /dev/null +++ b/src/v1_25/api/batch/v1/job_spec.rs @@ -0,0 +1,391 @@ +// 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, + + /// 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 nil 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, + + /// 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 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 alpha-level. To use this field, you must enable the `JobPodFailurePolicy` feature gate (disabled by default). + pub pod_failure_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, + + /// 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. 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.completion_mode, other.completion_mode); + crate::DeepMerge::merge_from(&mut self.completions, other.completions); + crate::DeepMerge::merge_from(&mut self.manual_selector, other.manual_selector); + 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.selector, other.selector); + 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_completion_mode, + Key_completions, + Key_manual_selector, + Key_parallelism, + Key_pod_failure_policy, + Key_selector, + 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, + "completionMode" => Field::Key_completion_mode, + "completions" => Field::Key_completions, + "manualSelector" => Field::Key_manual_selector, + "parallelism" => Field::Key_parallelism, + "podFailurePolicy" => Field::Key_pod_failure_policy, + "selector" => Field::Key_selector, + "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_completion_mode: Option = None; + let mut value_completions: Option = None; + let mut value_manual_selector: Option = None; + let mut value_parallelism: Option = None; + let mut value_pod_failure_policy: Option = None; + let mut value_selector: 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_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_manual_selector => value_manual_selector = 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_selector => value_selector = 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, + completion_mode: value_completion_mode, + completions: value_completions, + manual_selector: value_manual_selector, + parallelism: value_parallelism, + pod_failure_policy: value_pod_failure_policy, + selector: value_selector, + suspend: value_suspend, + template: value_template.unwrap_or_default(), + ttl_seconds_after_finished: value_ttl_seconds_after_finished, + }) + } + } + + deserializer.deserialize_struct( + "JobSpec", + &[ + "activeDeadlineSeconds", + "backoffLimit", + "completionMode", + "completions", + "manualSelector", + "parallelism", + "podFailurePolicy", + "selector", + "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.completion_mode.as_ref().map_or(0, |_| 1) + + self.completions.as_ref().map_or(0, |_| 1) + + self.manual_selector.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.selector.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.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.manual_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "manualSelector", 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.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", 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() + }), + ), + ( + "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 nil 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() + }), + ), + ( + "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() + }), + ), + ( + "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 alpha-level. To use this field, you must enable the `JobPodFailurePolicy` feature gate (disabled by default).".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("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) + }, + ), + ( + "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. 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_25/api/batch/v1/job_status.rs b/src/v1_25/api/batch/v1/job_status.rs new file mode 100644 index 0000000000..49d53d7f71 --- /dev/null +++ b/src/v1_25/api/batch/v1/job_status.rs @@ -0,0 +1,342 @@ +// 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. + 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 only set when the job finishes successfully. + 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. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + pub conditions: Option>, + + /// The number of pods which reached phase Failed. + pub failed: Option, + + /// The number of pods which have a Ready condition. + /// + /// This field is beta-level. The job controller populates the field when the feature gate JobReadyPods is enabled (enabled by default). + 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. + pub start_time: Option, + + /// The number of pods which reached phase Succeeded. + pub succeeded: 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. + /// + /// This field is beta-level. The job controller only makes use of this field when the feature gate JobTrackingWithFinalizers is enabled (enabled by default). Old jobs might not be tracked using this field, in which case the field remains null. + 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.failed, other.failed); + 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.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_ready, + Key_start_time, + Key_succeeded, + 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, + "ready" => Field::Key_ready, + "startTime" => Field::Key_start_time, + "succeeded" => Field::Key_succeeded, + "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_ready: Option = None; + let mut value_start_time: Option = None; + let mut value_succeeded: 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_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_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, + ready: value_ready, + start_time: value_start_time, + succeeded: value_succeeded, + uncounted_terminated_pods: value_uncounted_terminated_pods, + }) + } + } + + deserializer.deserialize_struct( + "JobStatus", + &[ + "active", + "completedIndexes", + "completionTime", + "conditions", + "failed", + "ready", + "startTime", + "succeeded", + "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.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.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.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.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.".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 only set when the job finishes successfully.".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. 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::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.".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() + }), + ), + ( + "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.\n\nThis field is beta-level. The job controller populates the field when the feature gate JobReadyPods 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() + }), + ), + ( + "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.".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.".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: (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\n counter.\n\nThis field is beta-level. The job controller only makes use of this field when the feature gate JobTrackingWithFinalizers is enabled (enabled by default). Old jobs might not be tracked using this field, in which case the field remains null.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/batch/v1/job_template_spec.rs b/src/v1_25/api/batch/v1/job_template_spec.rs new file mode 100644 index 0000000000..7c0d417b0a --- /dev/null +++ b/src/v1_25/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_25/api/batch/v1/mod.rs b/src/v1_25/api/batch/v1/mod.rs new file mode 100644 index 0000000000..09570f200d --- /dev/null +++ b/src/v1_25/api/batch/v1/mod.rs @@ -0,0 +1,43 @@ + +mod cron_job; +pub use self::cron_job::CronJob; +#[cfg(feature = "api")] pub use self::cron_job::ReadCronJobResponse; +#[cfg(feature = "api")] pub use self::cron_job::ReadCronJobStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::job::ReadJobResponse; +#[cfg(feature = "api")] pub use self::job::ReadJobStatusResponse; + +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 uncounted_terminated_pods; +pub use self::uncounted_terminated_pods::UncountedTerminatedPods; diff --git a/src/v1_25/api/batch/v1/pod_failure_policy.rs b/src/v1_25/api/batch/v1/pod_failure_policy.rs new file mode 100644 index 0000000000..5edb569fbe --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs b/src/v1_25/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs new file mode 100644 index 0000000000..7c66651da8 --- /dev/null +++ b/src/v1_25/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs @@ -0,0 +1,193 @@ +// 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::DeepMerge::merge_from(&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: - 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.\n\n".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_25/api/batch/v1/pod_failure_policy_on_pod_conditions_pattern.rs b/src/v1_25/api/batch/v1/pod_failure_policy_on_pod_conditions_pattern.rs new file mode 100644 index 0000000000..67e4ecb707 --- /dev/null +++ b/src/v1_25/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_25/api/batch/v1/pod_failure_policy_rule.rs b/src/v1_25/api/batch/v1/pod_failure_policy_rule.rs new file mode 100644 index 0000000000..3898f424d4 --- /dev/null +++ b/src/v1_25/api/batch/v1/pod_failure_policy_rule.rs @@ -0,0 +1,187 @@ +// 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. + /// - 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: Vec, +} + +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::DeepMerge::merge_from(&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.unwrap_or_default(), + }) + } + } + + 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", + 2 + + self.on_exit_codes.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)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "onPodConditions", &self.on_pod_conditions)?; + 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: - FailJob: indicates that the pod's job is marked as Failed and all\n running pods are terminated.\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.\n\n".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(), + "onPodConditions".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/batch/v1/uncounted_terminated_pods.rs b/src/v1_25/api/batch/v1/uncounted_terminated_pods.rs new file mode 100644 index 0000000000..8235855121 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.failed, other.failed); + crate::DeepMerge::merge_from(&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_25/api/certificates/mod.rs b/src/v1_25/api/certificates/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/certificates/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/certificates/v1/certificate_signing_request.rs b/src/v1_25/api/certificates/v1/certificate_signing_request.rs new file mode 100644 index 0000000000..066a900b7c --- /dev/null +++ b/src/v1_25/api/certificates/v1/certificate_signing_request.rs @@ -0,0 +1,883 @@ +// 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, +} + +// Begin certificates.k8s.io/v1/CertificateSigningRequest + +// Generated from operation createCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// create a CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::certificates::v1::CertificateSigningRequest, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/v1/certificatesigningrequests?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// delete a CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCertificatesV1CollectionCertificateSigningRequest + +impl CertificateSigningRequest { + /// delete collection of CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/v1/certificatesigningrequests?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// list or watch objects of kind CertificateSigningRequest + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/v1/certificatesigningrequests?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// partially update the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCertificatesV1CertificateSigningRequestApproval + +impl CertificateSigningRequest { + /// partially update approval of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_approval( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCertificatesV1CertificateSigningRequestStatus + +impl CertificateSigningRequest { + /// partially update status of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// read the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCertificateSigningRequestResponse`]`>` constructor, or [`ReadCertificateSigningRequestResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CertificateSigningRequest::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCertificateSigningRequestResponse { + Ok(crate::api::certificates::v1::CertificateSigningRequest), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCertificateSigningRequestResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCertificateSigningRequestResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCertificateSigningRequestResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCertificatesV1CertificateSigningRequestApproval + +impl CertificateSigningRequest { + /// read approval of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCertificateSigningRequestApprovalResponse`]`>` constructor, or [`ReadCertificateSigningRequestApprovalResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + #[cfg(feature = "api")] + pub fn read_approval( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CertificateSigningRequest::read_approval`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCertificateSigningRequestApprovalResponse { + Ok(crate::api::certificates::v1::CertificateSigningRequest), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCertificateSigningRequestApprovalResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCertificateSigningRequestApprovalResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCertificateSigningRequestApprovalResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCertificatesV1CertificateSigningRequestStatus + +impl CertificateSigningRequest { + /// read status of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCertificateSigningRequestStatusResponse`]`>` constructor, or [`ReadCertificateSigningRequestStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CertificateSigningRequest::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCertificateSigningRequestStatusResponse { + Ok(crate::api::certificates::v1::CertificateSigningRequest), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCertificateSigningRequestStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCertificateSigningRequestStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCertificateSigningRequestStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// replace the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::certificates::v1::CertificateSigningRequest, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCertificatesV1CertificateSigningRequestApproval + +impl CertificateSigningRequest { + /// replace approval of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_approval( + name: &str, + body: &crate::api::certificates::v1::CertificateSigningRequest, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCertificatesV1CertificateSigningRequestStatus + +impl CertificateSigningRequest { + /// replace status of the specified CertificateSigningRequest + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CertificateSigningRequest + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::certificates::v1::CertificateSigningRequest, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCertificatesV1CertificateSigningRequest + +impl CertificateSigningRequest { + /// list or watch objects of kind CertificateSigningRequest + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/v1/certificatesigningrequests?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End certificates.k8s.io/v1/CertificateSigningRequest + +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_25/api/certificates/v1/certificate_signing_request_condition.rs b/src/v1_25/api/certificates/v1/certificate_signing_request_condition.rs new file mode 100644 index 0000000000..81202d66de --- /dev/null +++ b/src/v1_25/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_25/api/certificates/v1/certificate_signing_request_spec.rs b/src/v1_25/api/certificates/v1/certificate_signing_request_spec.rs new file mode 100644 index 0000000000..549452fb32 --- /dev/null +++ b/src/v1_25/api/certificates/v1/certificate_signing_request_spec.rs @@ -0,0 +1,383 @@ +// 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::DeepMerge::merge_from(&mut self.extra, other.extra); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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_25/api/certificates/v1/certificate_signing_request_status.rs b/src/v1_25/api/certificates/v1/certificate_signing_request_status.rs new file mode 100644 index 0000000000..81fb876580 --- /dev/null +++ b/src/v1_25/api/certificates/v1/certificate_signing_request_status.rs @@ -0,0 +1,178 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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_25/api/certificates/v1/mod.rs b/src/v1_25/api/certificates/v1/mod.rs new file mode 100644 index 0000000000..57fbb438b7 --- /dev/null +++ b/src/v1_25/api/certificates/v1/mod.rs @@ -0,0 +1,15 @@ + +mod certificate_signing_request; +pub use self::certificate_signing_request::CertificateSigningRequest; +#[cfg(feature = "api")] pub use self::certificate_signing_request::ReadCertificateSigningRequestResponse; +#[cfg(feature = "api")] pub use self::certificate_signing_request::ReadCertificateSigningRequestApprovalResponse; +#[cfg(feature = "api")] pub use self::certificate_signing_request::ReadCertificateSigningRequestStatusResponse; + +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_25/api/coordination/mod.rs b/src/v1_25/api/coordination/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/coordination/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/coordination/v1/lease.rs b/src/v1_25/api/coordination/v1/lease.rs new file mode 100644 index 0000000000..3e32685cbc --- /dev/null +++ b/src/v1_25/api/coordination/v1/lease.rs @@ -0,0 +1,672 @@ +// 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, + + /// Specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +// Begin coordination.k8s.io/v1/Lease + +// Generated from operation createCoordinationV1NamespacedLease + +impl Lease { + /// create a Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::coordination::v1::Lease, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoordinationV1CollectionNamespacedLease + +impl Lease { + /// delete collection of Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoordinationV1NamespacedLease + +impl Lease { + /// delete a Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Lease + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoordinationV1LeaseForAllNamespaces + +impl Lease { + /// list or watch objects of kind Lease + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/coordination.k8s.io/v1/leases?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoordinationV1NamespacedLease + +impl Lease { + /// list or watch objects of kind Lease + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoordinationV1NamespacedLease + +impl Lease { + /// partially update the specified Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Lease + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoordinationV1NamespacedLease + +impl Lease { + /// read the specified Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadLeaseResponse`]`>` constructor, or [`ReadLeaseResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Lease + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Lease::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadLeaseResponse { + Ok(crate::api::coordination::v1::Lease), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadLeaseResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadLeaseResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadLeaseResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoordinationV1NamespacedLease + +impl Lease { + /// replace the specified Lease + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Lease + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::coordination::v1::Lease, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoordinationV1LeaseForAllNamespaces + +impl Lease { + /// list or watch objects of kind Lease + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/coordination.k8s.io/v1/leases?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoordinationV1NamespacedLease + +impl Lease { + /// list or watch objects of kind Lease + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End coordination.k8s.io/v1/Lease + +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("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_25/api/coordination/v1/lease_spec.rs b/src/v1_25/api/coordination/v1/lease_spec.rs new file mode 100644 index 0000000000..03f3f8c2bb --- /dev/null +++ b/src/v1_25/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_25/api/coordination/v1/mod.rs b/src/v1_25/api/coordination/v1/mod.rs new file mode 100644 index 0000000000..9660aabbb8 --- /dev/null +++ b/src/v1_25/api/coordination/v1/mod.rs @@ -0,0 +1,7 @@ + +mod lease; +pub use self::lease::Lease; +#[cfg(feature = "api")] pub use self::lease::ReadLeaseResponse; + +mod lease_spec; +pub use self::lease_spec::LeaseSpec; diff --git a/src/v1_25/api/core/mod.rs b/src/v1_25/api/core/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/core/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/core/v1/affinity.rs b/src/v1_25/api/core/v1/affinity.rs new file mode 100644 index 0000000000..e88d625a51 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/attached_volume.rs b/src/v1_25/api/core/v1/attached_volume.rs new file mode 100644 index 0000000000..ad4de07c17 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/aws_elastic_block_store_volume_source.rs b/src/v1_25/api/core/v1/aws_elastic_block_store_volume_source.rs new file mode 100644 index 0000000000..21c6cb87d6 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/azure_disk_volume_source.rs b/src/v1_25/api/core/v1/azure_disk_volume_source.rs new file mode 100644 index 0000000000..711a013e31 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/azure_file_persistent_volume_source.rs b/src/v1_25/api/core/v1/azure_file_persistent_volume_source.rs new file mode 100644 index 0000000000..71637c7da5 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/azure_file_volume_source.rs b/src/v1_25/api/core/v1/azure_file_volume_source.rs new file mode 100644 index 0000000000..0bf97282a0 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/binding.rs b/src/v1_25/api/core/v1/binding.rs new file mode 100644 index 0000000000..b3aeda2f48 --- /dev/null +++ b/src/v1_25/api/core/v1/binding.rs @@ -0,0 +1,306 @@ +// 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, +} + +// Begin /v1/Binding + +// Generated from operation createCoreV1NamespacedBinding + +impl Binding { + /// create a Binding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Binding, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/bindings?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation createCoreV1NamespacedPodBinding + +impl Binding { + /// create binding of a Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Binding + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create_pod( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Binding, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/binding?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Binding + +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_25/api/core/v1/capabilities.rs b/src/v1_25/api/core/v1/capabilities.rs new file mode 100644 index 0000000000..6045e4f5d2 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.add, other.add); + crate::DeepMerge::merge_from(&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_25/api/core/v1/ceph_fs_persistent_volume_source.rs b/src/v1_25/api/core/v1/ceph_fs_persistent_volume_source.rs new file mode 100644 index 0000000000..13104d3d90 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/ceph_fs_volume_source.rs b/src/v1_25/api/core/v1/ceph_fs_volume_source.rs new file mode 100644 index 0000000000..bb24b08edb --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/cinder_persistent_volume_source.rs b/src/v1_25/api/core/v1/cinder_persistent_volume_source.rs new file mode 100644 index 0000000000..5c22d35fb8 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/cinder_volume_source.rs b/src/v1_25/api/core/v1/cinder_volume_source.rs new file mode 100644 index 0000000000..b6cbb4ce10 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/client_ip_config.rs b/src/v1_25/api/core/v1/client_ip_config.rs new file mode 100644 index 0000000000..4010999235 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/component_condition.rs b/src/v1_25/api/core/v1/component_condition.rs new file mode 100644 index 0000000000..a7dc3ee806 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/component_status.rs b/src/v1_25/api/core/v1/component_status.rs new file mode 100644 index 0000000000..ecddf82170 --- /dev/null +++ b/src/v1_25/api/core/v1/component_status.rs @@ -0,0 +1,359 @@ +// 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, +} + +// Begin /v1/ComponentStatus + +// Generated from operation listCoreV1ComponentStatus + +impl ComponentStatus { + /// list objects of kind ComponentStatus + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/componentstatuses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1ComponentStatus + +impl ComponentStatus { + /// read the specified ComponentStatus + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadComponentStatusResponse`]`>` constructor, or [`ReadComponentStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ComponentStatus + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/componentstatuses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ComponentStatus::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadComponentStatusResponse { + Ok(crate::api::core::v1::ComponentStatus), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadComponentStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadComponentStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadComponentStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation watchCoreV1ComponentStatus + +impl ComponentStatus { + /// list objects of kind ComponentStatus + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/componentstatuses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/ComponentStatus + +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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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_25/api/core/v1/config_map.rs b/src/v1_25/api/core/v1/config_map.rs new file mode 100644 index 0000000000..361b45a3a1 --- /dev/null +++ b/src/v1_25/api/core/v1/config_map.rs @@ -0,0 +1,741 @@ +// 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, +} + +// Begin /v1/ConfigMap + +// Generated from operation createCoreV1NamespacedConfigMap + +impl ConfigMap { + /// create a ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::ConfigMap, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedConfigMap + +impl ConfigMap { + /// delete collection of ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedConfigMap + +impl ConfigMap { + /// delete a ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ConfigMap + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1ConfigMapForAllNamespaces + +impl ConfigMap { + /// list or watch objects of kind ConfigMap + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/configmaps?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedConfigMap + +impl ConfigMap { + /// list or watch objects of kind ConfigMap + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedConfigMap + +impl ConfigMap { + /// partially update the specified ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ConfigMap + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedConfigMap + +impl ConfigMap { + /// read the specified ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadConfigMapResponse`]`>` constructor, or [`ReadConfigMapResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ConfigMap + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ConfigMap::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadConfigMapResponse { + Ok(crate::api::core::v1::ConfigMap), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadConfigMapResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadConfigMapResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadConfigMapResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedConfigMap + +impl ConfigMap { + /// replace the specified ConfigMap + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ConfigMap + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ConfigMap, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1ConfigMapForAllNamespaces + +impl ConfigMap { + /// list or watch objects of kind ConfigMap + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/configmaps?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedConfigMap + +impl ConfigMap { + /// list or watch objects of kind ConfigMap + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/configmaps?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/ConfigMap + +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::DeepMerge::merge_from(&mut self.binary_data, other.binary_data); + crate::DeepMerge::merge_from(&mut self.data, other.data); + 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_25/api/core/v1/config_map_env_source.rs b/src/v1_25/api/core/v1/config_map_env_source.rs new file mode 100644 index 0000000000..f8cb8d16e5 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/config_map_key_selector.rs b/src/v1_25/api/core/v1/config_map_key_selector.rs new file mode 100644 index 0000000000..927219d6cd --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/config_map_node_config_source.rs b/src/v1_25/api/core/v1/config_map_node_config_source.rs new file mode 100644 index 0000000000..75c599bc9b --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/config_map_projection.rs b/src/v1_25/api/core/v1/config_map_projection.rs new file mode 100644 index 0000000000..673d1527ac --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/config_map_volume_source.rs b/src/v1_25/api/core/v1/config_map_volume_source.rs new file mode 100644 index 0000000000..d34a1a17da --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/container.rs b/src/v1_25/api/core/v1/container.rs new file mode 100644 index 0000000000..e7ec05fb49 --- /dev/null +++ b/src/v1_25/api/core/v1/container.rs @@ -0,0 +1,693 @@ +// 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, + + /// Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub resources: 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::DeepMerge::merge_from(&mut self.args, other.args); + crate::DeepMerge::merge_from(&mut self.command, other.command); + crate::DeepMerge::merge_from(&mut self.env, other.env); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.ports, other.ports); + crate::DeepMerge::merge_from(&mut self.readiness_probe, other.readiness_probe); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + 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::DeepMerge::merge_from(&mut self.volume_devices, other.volume_devices); + crate::DeepMerge::merge_from(&mut self.volume_mounts, other.volume_mounts); + 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_resources, + 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, + "resources" => Field::Key_resources, + "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_resources: 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_resources => value_resources = 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, + resources: value_resources, + 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", + "resources", + "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.resources.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.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", 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\n\n".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) + }, + ), + ( + "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) + }, + ), + ( + "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.\n\n".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_25/api/core/v1/container_image.rs b/src/v1_25/api/core/v1/container_image.rs new file mode 100644 index 0000000000..a708155b7c --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/container_port.rs b/src/v1_25/api/core/v1/container_port.rs new file mode 100644 index 0000000000..3155034d25 --- /dev/null +++ b/src/v1_25/api/core/v1/container_port.rs @@ -0,0 +1,231 @@ +// 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\".\n\n".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_25/api/core/v1/container_state.rs b/src/v1_25/api/core/v1/container_state.rs new file mode 100644 index 0000000000..738023c714 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/container_state_running.rs b/src/v1_25/api/core/v1/container_state_running.rs new file mode 100644 index 0000000000..cc59b48091 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/container_state_terminated.rs b/src/v1_25/api/core/v1/container_state_terminated.rs new file mode 100644 index 0000000000..edd0af9272 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/container_state_waiting.rs b/src/v1_25/api/core/v1/container_state_waiting.rs new file mode 100644 index 0000000000..e9abda377d --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/container_status.rs b/src/v1_25/api/core/v1/container_status.rs new file mode 100644 index 0000000000..ca8be2c7a9 --- /dev/null +++ b/src/v1_25/api/core/v1/container_status.rs @@ -0,0 +1,321 @@ +// 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 { + /// Container's ID in the format '\://\'. + pub container_id: Option, + + /// The image the container is running. More info: https://kubernetes.io/docs/concepts/containers/images. + pub image: String, + + /// ImageID of the container's image. + pub image_id: String, + + /// Details about the container's last termination condition. + pub last_state: Option, + + /// This must be a DNS_LABEL. Each container in a pod must have a unique name. Cannot be updated. + pub name: String, + + /// Specifies whether the container has passed its readiness probe. + pub ready: bool, + + /// The number of times the container has been restarted. + pub restart_count: i32, + + /// Specifies whether the container has 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. Is always true when no startupProbe is defined. + pub started: Option, + + /// Details about the container's current condition. + pub state: Option, +} + +impl crate::DeepMerge for ContainerStatus { + fn merge_from(&mut self, other: Self) { + 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.restart_count, other.restart_count); + crate::DeepMerge::merge_from(&mut self.started, other.started); + crate::DeepMerge::merge_from(&mut self.state, other.state); + } +} + +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_container_id, + Key_image, + Key_image_id, + Key_last_state, + Key_name, + Key_ready, + Key_restart_count, + Key_started, + Key_state, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> 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, + "image" => Field::Key_image, + "imageID" => Field::Key_image_id, + "lastState" => Field::Key_last_state, + "name" => Field::Key_name, + "ready" => Field::Key_ready, + "restartCount" => Field::Key_restart_count, + "started" => Field::Key_started, + "state" => Field::Key_state, + _ => 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_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_restart_count: Option = None; + let mut value_started: Option = None; + let mut value_state: 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_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_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::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerStatus { + 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(), + restart_count: value_restart_count.unwrap_or_default(), + started: value_started, + state: value_state, + }) + } + } + + deserializer.deserialize_struct( + "ContainerStatus", + &[ + "containerID", + "image", + "imageID", + "lastState", + "name", + "ready", + "restartCount", + "started", + "state", + ], + 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.container_id.as_ref().map_or(0, |_| 1) + + self.last_state.as_ref().map_or(0, |_| 1) + + self.started.as_ref().map_or(0, |_| 1) + + self.state.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, "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)?; + 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)?; + } + 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: [ + ( + "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() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The image the container is running. 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 of the container's image.".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("Details about the container's last termination condition.".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("This must be a DNS_LABEL. Each container in a pod must have a unique name. 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("Specifies whether the container has passed its readiness probe.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "restartCount".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 the container has been restarted.".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("Specifies whether the container has 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. Is always true when no startupProbe is defined.".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("Details about the container's current condition.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].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_25/api/core/v1/csi_persistent_volume_source.rs b/src/v1_25/api/core/v1/csi_persistent_volume_source.rs new file mode 100644 index 0000000000..27b531ff56 --- /dev/null +++ b/src/v1_25/api/core/v1/csi_persistent_volume_source.rs @@ -0,0 +1,360 @@ +// 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 is an beta field and requires enabling ExpandCSIVolumes feature gate. 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 is an alpha field and requires enabling CSINodeExpandSecret feature gate. 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::DeepMerge::merge_from(&mut self.volume_attributes, other.volume_attributes); + 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 is an beta field and requires enabling ExpandCSIVolumes feature gate. 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 is an alpha field and requires enabling CSINodeExpandSecret feature gate. 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_25/api/core/v1/csi_volume_source.rs b/src/v1_25/api/core/v1/csi_volume_source.rs new file mode 100644 index 0000000000..ab72f34cdc --- /dev/null +++ b/src/v1_25/api/core/v1/csi_volume_source.rs @@ -0,0 +1,237 @@ +// 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::DeepMerge::merge_from(&mut self.volume_attributes, other.volume_attributes); + } +} + +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_25/api/core/v1/daemon_endpoint.rs b/src/v1_25/api/core/v1/daemon_endpoint.rs new file mode 100644 index 0000000000..795c3e3425 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/downward_api_projection.rs b/src/v1_25/api/core/v1/downward_api_projection.rs new file mode 100644 index 0000000000..de0fca6185 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/downward_api_volume_file.rs b/src/v1_25/api/core/v1/downward_api_volume_file.rs new file mode 100644 index 0000000000..9f1d8deed1 --- /dev/null +++ b/src/v1_25/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 and namespace 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 and namespace 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_25/api/core/v1/downward_api_volume_source.rs b/src/v1_25/api/core/v1/downward_api_volume_source.rs new file mode 100644 index 0000000000..214c15f03f --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/empty_dir_volume_source.rs b/src/v1_25/api/core/v1/empty_dir_volume_source.rs new file mode 100644 index 0000000000..baa722dbb4 --- /dev/null +++ b/src/v1_25/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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/volumes#emptydir".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/core/v1/endpoint_address.rs b/src/v1_25/api/core/v1/endpoint_address.rs new file mode 100644 index 0000000000..fa473b3a0f --- /dev/null +++ b/src/v1_25/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), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready. + 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), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready.".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_25/api/core/v1/endpoint_port.rs b/src/v1_25/api/core/v1/endpoint_port.rs new file mode 100644 index 0000000000..50aac5b22c --- /dev/null +++ b/src/v1_25/api/core/v1/endpoint_port.rs @@ -0,0 +1,205 @@ +// 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use 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.\n\n".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_25/api/core/v1/endpoint_subset.rs b/src/v1_25/api/core/v1/endpoint_subset.rs new file mode 100644 index 0000000000..45a0853432 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.addresses, other.addresses); + crate::DeepMerge::merge_from(&mut self.not_ready_addresses, other.not_ready_addresses); + crate::DeepMerge::merge_from(&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_25/api/core/v1/endpoints.rs b/src/v1_25/api/core/v1/endpoints.rs new file mode 100644 index 0000000000..ed9beaf356 --- /dev/null +++ b/src/v1_25/api/core/v1/endpoints.rs @@ -0,0 +1,688 @@ +// 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>, +} + +// Begin /v1/Endpoints + +// Generated from operation createCoreV1NamespacedEndpoints + +impl Endpoints { + /// create Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Endpoints, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedEndpoints + +impl Endpoints { + /// delete collection of Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedEndpoints + +impl Endpoints { + /// delete Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Endpoints + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1EndpointsForAllNamespaces + +impl Endpoints { + /// list or watch objects of kind Endpoints + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/endpoints?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedEndpoints + +impl Endpoints { + /// list or watch objects of kind Endpoints + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedEndpoints + +impl Endpoints { + /// partially update the specified Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Endpoints + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedEndpoints + +impl Endpoints { + /// read the specified Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadEndpointsResponse`]`>` constructor, or [`ReadEndpointsResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Endpoints + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Endpoints::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadEndpointsResponse { + Ok(crate::api::core::v1::Endpoints), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadEndpointsResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadEndpointsResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadEndpointsResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedEndpoints + +impl Endpoints { + /// replace the specified Endpoints + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Endpoints + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Endpoints, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1EndpointsForAllNamespaces + +impl Endpoints { + /// list or watch objects of kind Endpoints + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/endpoints?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedEndpoints + +impl Endpoints { + /// list or watch objects of kind Endpoints + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/endpoints?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Endpoints + +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::DeepMerge::merge_from(&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_25/api/core/v1/env_from_source.rs b/src/v1_25/api/core/v1/env_from_source.rs new file mode 100644 index 0000000000..3f27d33983 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/env_var.rs b/src/v1_25/api/core/v1/env_var.rs new file mode 100644 index 0000000000..98d7b86508 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/env_var_source.rs b/src/v1_25/api/core/v1/env_var_source.rs new file mode 100644 index 0000000000..9ee1065c69 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/ephemeral_container.rs b/src/v1_25/api/core/v1/ephemeral_container.rs new file mode 100644 index 0000000000..985935d50f --- /dev/null +++ b/src/v1_25/api/core/v1/ephemeral_container.rs @@ -0,0 +1,722 @@ +// 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 are not allowed for ephemeral containers. Ephemeral containers use spare resources already allocated to the pod. + pub resources: 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::DeepMerge::merge_from(&mut self.args, other.args); + crate::DeepMerge::merge_from(&mut self.command, other.command); + crate::DeepMerge::merge_from(&mut self.env, other.env); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.ports, other.ports); + crate::DeepMerge::merge_from(&mut self.readiness_probe, other.readiness_probe); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + 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::DeepMerge::merge_from(&mut self.volume_devices, other.volume_devices); + crate::DeepMerge::merge_from(&mut self.volume_mounts, other.volume_mounts); + 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_resources, + 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, + "resources" => Field::Key_resources, + "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_resources: 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_resources => value_resources = 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, + resources: value_resources, + 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", + "resources", + "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.resources.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.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", 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\n\n".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) + }, + ), + ( + "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) + }, + ), + ( + "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.\n\n".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_25/api/core/v1/ephemeral_volume_source.rs b/src/v1_25/api/core/v1/ephemeral_volume_source.rs new file mode 100644 index 0000000000..3bdcc4023c --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/event.rs b/src/v1_25/api/core/v1/event.rs new file mode 100644 index 0000000000..d6f2ae1243 --- /dev/null +++ b/src/v1_25/api/core/v1/event.rs @@ -0,0 +1,996 @@ +// 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, +} + +// Begin /v1/Event + +// Generated from operation createCoreV1NamespacedEvent + +impl Event { + /// create an Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Event, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedEvent + +impl Event { + /// delete collection of Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedEvent + +impl Event { + /// delete an Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1EventForAllNamespaces + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/events?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedEvent + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedEvent + +impl Event { + /// partially update the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedEvent + +impl Event { + /// read the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadEventResponse`]`>` constructor, or [`ReadEventResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Event::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadEventResponse { + Ok(crate::api::core::v1::Event), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadEventResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadEventResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadEventResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedEvent + +impl Event { + /// replace the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Event, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1EventForAllNamespaces + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/events?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedEvent + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Event + +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_25/api/core/v1/event_series.rs b/src/v1_25/api/core/v1/event_series.rs new file mode 100644 index 0000000000..f28edcbb9b --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/event_source.rs b/src/v1_25/api/core/v1/event_source.rs new file mode 100644 index 0000000000..16e80db560 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/exec_action.rs b/src/v1_25/api/core/v1/exec_action.rs new file mode 100644 index 0000000000..fc5ddd099a --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/fc_volume_source.rs b/src/v1_25/api/core/v1/fc_volume_source.rs new file mode 100644 index 0000000000..16dda61ef3 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.target_wwns, other.target_wwns); + crate::DeepMerge::merge_from(&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_25/api/core/v1/flex_persistent_volume_source.rs b/src/v1_25/api/core/v1/flex_persistent_volume_source.rs new file mode 100644 index 0000000000..1c73341c0c --- /dev/null +++ b/src/v1_25/api/core/v1/flex_persistent_volume_source.rs @@ -0,0 +1,237 @@ +// 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::DeepMerge::merge_from(&mut self.options, other.options); + 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_25/api/core/v1/flex_volume_source.rs b/src/v1_25/api/core/v1/flex_volume_source.rs new file mode 100644 index 0000000000..caad40ad2b --- /dev/null +++ b/src/v1_25/api/core/v1/flex_volume_source.rs @@ -0,0 +1,237 @@ +// 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::DeepMerge::merge_from(&mut self.options, other.options); + 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_25/api/core/v1/flocker_volume_source.rs b/src/v1_25/api/core/v1/flocker_volume_source.rs new file mode 100644 index 0000000000..fbdbeb717d --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/gce_persistent_disk_volume_source.rs b/src/v1_25/api/core/v1/gce_persistent_disk_volume_source.rs new file mode 100644 index 0000000000..8b8951cac6 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/git_repo_volume_source.rs b/src/v1_25/api/core/v1/git_repo_volume_source.rs new file mode 100644 index 0000000000..5af2e332f1 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/glusterfs_persistent_volume_source.rs b/src/v1_25/api/core/v1/glusterfs_persistent_volume_source.rs new file mode 100644 index 0000000000..88c2146139 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/glusterfs_volume_source.rs b/src/v1_25/api/core/v1/glusterfs_volume_source.rs new file mode 100644 index 0000000000..ab4e62c2a5 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/grpc_action.rs b/src/v1_25/api/core/v1/grpc_action.rs new file mode 100644 index 0000000000..b339c61c87 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/host_alias.rs b/src/v1_25/api/core/v1/host_alias.rs new file mode 100644 index 0000000000..9320f6d9e1 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/host_path_volume_source.rs b/src/v1_25/api/core/v1/host_path_volume_source.rs new file mode 100644 index 0000000000..7016c0f027 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/http_get_action.rs b/src/v1_25/api/core/v1/http_get_action.rs new file mode 100644 index 0000000000..cec454faa3 --- /dev/null +++ b/src/v1_25/api/core/v1/http_get_action.rs @@ -0,0 +1,233 @@ +// 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::DeepMerge::merge_from(&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.\n\n".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_25/api/core/v1/http_header.rs b/src/v1_25/api/core/v1/http_header.rs new file mode 100644 index 0000000000..30d767e777 --- /dev/null +++ b/src/v1_25/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 + 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".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_25/api/core/v1/iscsi_persistent_volume_source.rs b/src/v1_25/api/core/v1/iscsi_persistent_volume_source.rs new file mode 100644 index 0000000000..e7285139af --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/iscsi_volume_source.rs b/src/v1_25/api/core/v1/iscsi_volume_source.rs new file mode 100644 index 0000000000..0990284c06 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/key_to_path.rs b/src/v1_25/api/core/v1/key_to_path.rs new file mode 100644 index 0000000000..6ea9c5e281 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/lifecycle.rs b/src/v1_25/api/core/v1/lifecycle.rs new file mode 100644 index 0000000000..b47b1488c5 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/lifecycle_handler.rs b/src/v1_25/api/core/v1/lifecycle_handler.rs new file mode 100644 index 0000000000..717d9623a9 --- /dev/null +++ b/src/v1_25/api/core/v1/lifecycle_handler.rs @@ -0,0 +1,177 @@ +// 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, + + /// 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.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_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, + "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_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_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, + tcp_socket: value_tcp_socket, + }) + } + } + + deserializer.deserialize_struct( + "LifecycleHandler", + &[ + "exec", + "httpGet", + "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.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.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) + }, + ), + ( + "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_25/api/core/v1/limit_range.rs b/src/v1_25/api/core/v1/limit_range.rs new file mode 100644 index 0000000000..8cb5242d90 --- /dev/null +++ b/src/v1_25/api/core/v1/limit_range.rs @@ -0,0 +1,672 @@ +// 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, +} + +// Begin /v1/LimitRange + +// Generated from operation createCoreV1NamespacedLimitRange + +impl LimitRange { + /// create a LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::LimitRange, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedLimitRange + +impl LimitRange { + /// delete collection of LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedLimitRange + +impl LimitRange { + /// delete a LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the LimitRange + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1LimitRangeForAllNamespaces + +impl LimitRange { + /// list or watch objects of kind LimitRange + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/limitranges?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedLimitRange + +impl LimitRange { + /// list or watch objects of kind LimitRange + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedLimitRange + +impl LimitRange { + /// partially update the specified LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the LimitRange + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedLimitRange + +impl LimitRange { + /// read the specified LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadLimitRangeResponse`]`>` constructor, or [`ReadLimitRangeResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the LimitRange + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`LimitRange::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadLimitRangeResponse { + Ok(crate::api::core::v1::LimitRange), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadLimitRangeResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadLimitRangeResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadLimitRangeResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedLimitRange + +impl LimitRange { + /// replace the specified LimitRange + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the LimitRange + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::LimitRange, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1LimitRangeForAllNamespaces + +impl LimitRange { + /// list or watch objects of kind LimitRange + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/limitranges?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedLimitRange + +impl LimitRange { + /// list or watch objects of kind LimitRange + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/limitranges?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/LimitRange + +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_25/api/core/v1/limit_range_item.rs b/src/v1_25/api/core/v1/limit_range_item.rs new file mode 100644 index 0000000000..3aada5aaaa --- /dev/null +++ b/src/v1_25/api/core/v1/limit_range_item.rs @@ -0,0 +1,273 @@ +// 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::DeepMerge::merge_from(&mut self.default, other.default); + crate::DeepMerge::merge_from(&mut self.default_request, other.default_request); + crate::DeepMerge::merge_from(&mut self.max, other.max); + crate::DeepMerge::merge_from(&mut self.max_limit_request_ratio, other.max_limit_request_ratio); + crate::DeepMerge::merge_from(&mut self.min, other.min); + 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_25/api/core/v1/limit_range_spec.rs b/src/v1_25/api/core/v1/limit_range_spec.rs new file mode 100644 index 0000000000..d3db20e828 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/load_balancer_ingress.rs b/src/v1_25/api/core/v1/load_balancer_ingress.rs new file mode 100644 index 0000000000..fe804334cf --- /dev/null +++ b/src/v1_25/api/core/v1/load_balancer_ingress.rs @@ -0,0 +1,181 @@ +// 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, + + /// 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.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_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 = 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_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(LoadBalancerIngress { + hostname: value_hostname, + ip: value_ip, + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + "LoadBalancerIngress", + &[ + "hostname", + "ip", + "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.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 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() + }), + ), + ( + "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_25/api/core/v1/load_balancer_status.rs b/src/v1_25/api/core/v1/load_balancer_status.rs new file mode 100644 index 0000000000..46d791f8e1 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/local_object_reference.rs b/src/v1_25/api/core/v1/local_object_reference.rs new file mode 100644 index 0000000000..3ece11a42d --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/local_volume_source.rs b/src/v1_25/api/core/v1/local_volume_source.rs new file mode 100644 index 0000000000..0f0a5cb8d3 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/mod.rs b/src/v1_25/api/core/v1/mod.rs new file mode 100644 index 0000000000..f8cee71f8e --- /dev/null +++ b/src/v1_25/api/core/v1/mod.rs @@ -0,0 +1,584 @@ + +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 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 client_ip_config; +pub use self::client_ip_config::ClientIPConfig; + +mod component_condition; +pub use self::component_condition::ComponentCondition; + +mod component_status; +pub use self::component_status::ComponentStatus; +#[cfg(feature = "api")] pub use self::component_status::ReadComponentStatusResponse; + +mod config_map; +pub use self::config_map::ConfigMap; +#[cfg(feature = "api")] pub use self::config_map::ReadConfigMapResponse; + +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_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; +#[cfg(feature = "api")] pub use self::endpoints::ReadEndpointsResponse; + +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; +#[cfg(feature = "api")] pub use self::event::ReadEventResponse; + +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_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; +#[cfg(feature = "api")] pub use self::limit_range::ReadLimitRangeResponse; + +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 nfs_volume_source; +pub use self::nfs_volume_source::NFSVolumeSource; + +mod namespace; +pub use self::namespace::Namespace; +#[cfg(feature = "api")] pub use self::namespace::ReadNamespaceResponse; +#[cfg(feature = "api")] pub use self::namespace::ReadNamespaceStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::node::ConnectDeleteNodeProxyOptional; +#[cfg(feature = "api")] pub use self::node::ConnectDeleteNodeProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::node::ConnectGetNodeProxyOptional; +#[cfg(feature = "api")] pub use self::node::ConnectGetNodeProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPatchNodeProxyOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPatchNodeProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPostNodeProxyOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPostNodeProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPutNodeProxyOptional; +#[cfg(feature = "api")] pub use self::node::ConnectPutNodeProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::node::ReadNodeResponse; +#[cfg(feature = "api")] pub use self::node::ReadNodeStatusResponse; + +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_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; +#[cfg(feature = "api")] pub use self::persistent_volume::ReadPersistentVolumeResponse; +#[cfg(feature = "api")] pub use self::persistent_volume::ReadPersistentVolumeStatusResponse; + +mod persistent_volume_claim; +pub use self::persistent_volume_claim::PersistentVolumeClaim; +#[cfg(feature = "api")] pub use self::persistent_volume_claim::ReadPersistentVolumeClaimResponse; +#[cfg(feature = "api")] pub use self::persistent_volume_claim::ReadPersistentVolumeClaimStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::pod::ConnectDeletePodProxyOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectDeletePodProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectGetPodAttachOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectGetPodExecOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectGetPodPortforwardOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectGetPodProxyOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectGetPodProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPatchPodProxyOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPatchPodProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPostPodAttachOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPostPodExecOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPostPodPortforwardOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPostPodProxyOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPostPodProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPutPodProxyOptional; +#[cfg(feature = "api")] pub use self::pod::ConnectPutPodProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::pod::ReadPodResponse; +#[cfg(feature = "api")] pub use self::pod::ReadPodEphemeralcontainersResponse; +#[cfg(feature = "api")] pub use self::pod::{ReadPodLogOptional, ReadPodLogResponse}; +#[cfg(feature = "api")] pub use self::pod::ReadPodStatusResponse; + +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_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; +#[cfg(feature = "api")] pub use self::pod_template::ReadPodTemplateResponse; + +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; +#[cfg(feature = "api")] pub use self::replication_controller::ReadReplicationControllerResponse; +#[cfg(feature = "api")] pub use self::replication_controller::ReadReplicationControllerStatusResponse; + +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_field_selector; +pub use self::resource_field_selector::ResourceFieldSelector; + +mod resource_quota; +pub use self::resource_quota::ResourceQuota; +#[cfg(feature = "api")] pub use self::resource_quota::ReadResourceQuotaResponse; +#[cfg(feature = "api")] pub use self::resource_quota::ReadResourceQuotaStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::secret::ReadSecretResponse; + +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; +#[cfg(feature = "api")] pub use self::service::ConnectDeleteServiceProxyOptional; +#[cfg(feature = "api")] pub use self::service::ConnectDeleteServiceProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::service::ConnectGetServiceProxyOptional; +#[cfg(feature = "api")] pub use self::service::ConnectGetServiceProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPatchServiceProxyOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPatchServiceProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPostServiceProxyOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPostServiceProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPutServiceProxyOptional; +#[cfg(feature = "api")] pub use self::service::ConnectPutServiceProxyWithPathOptional; +#[cfg(feature = "api")] pub use self::service::ReadServiceResponse; +#[cfg(feature = "api")] pub use self::service::ReadServiceStatusResponse; + +mod service_account; +pub use self::service_account::ServiceAccount; +#[cfg(feature = "api")] pub use self::service_account::ReadServiceAccountResponse; + +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 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 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_node_affinity; +pub use self::volume_node_affinity::VolumeNodeAffinity; + +mod volume_projection; +pub use self::volume_projection::VolumeProjection; + +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_25/api/core/v1/namespace.rs b/src/v1_25/api/core/v1/namespace.rs new file mode 100644 index 0000000000..df31cdc0da --- /dev/null +++ b/src/v1_25/api/core/v1/namespace.rs @@ -0,0 +1,734 @@ +// 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, +} + +// Begin /v1/Namespace + +// Generated from operation createCoreV1Namespace + +impl Namespace { + /// create a Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::core::v1::Namespace, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/namespaces?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1Namespace + +impl Namespace { + /// delete a Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1Namespace + +impl Namespace { + /// list or watch objects of kind Namespace + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/namespaces?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1Namespace + +impl Namespace { + /// partially update the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespaceStatus + +impl Namespace { + /// partially update status of the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1Namespace + +impl Namespace { + /// read the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNamespaceResponse`]`>` constructor, or [`ReadNamespaceResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Namespace::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNamespaceResponse { + Ok(crate::api::core::v1::Namespace), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNamespaceResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNamespaceResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNamespaceResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespaceStatus + +impl Namespace { + /// read status of the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNamespaceStatusResponse`]`>` constructor, or [`ReadNamespaceStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Namespace::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNamespaceStatusResponse { + Ok(crate::api::core::v1::Namespace), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNamespaceStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNamespaceStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNamespaceStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1Namespace + +impl Namespace { + /// replace the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::core::v1::Namespace, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespaceFinalize + +impl Namespace { + /// replace finalize of the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_finalize( + name: &str, + body: &crate::api::core::v1::Namespace, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}/finalize?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespaceStatus + +impl Namespace { + /// replace status of the specified Namespace + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Namespace + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::core::v1::Namespace, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1Namespace + +impl Namespace { + /// list or watch objects of kind Namespace + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/namespaces?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Namespace + +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_25/api/core/v1/namespace_condition.rs b/src/v1_25/api/core/v1/namespace_condition.rs new file mode 100644 index 0000000000..fd2158f5cb --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/namespace_spec.rs b/src/v1_25/api/core/v1/namespace_spec.rs new file mode 100644 index 0000000000..5ae9e5ef2e --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/namespace_status.rs b/src/v1_25/api/core/v1/namespace_status.rs new file mode 100644 index 0000000000..7ccfbdac3e --- /dev/null +++ b/src/v1_25/api/core/v1/namespace_status.rs @@ -0,0 +1,157 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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/\n\n".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_25/api/core/v1/nfs_volume_source.rs b/src/v1_25/api/core/v1/nfs_volume_source.rs new file mode 100644 index 0000000000..d452e8f91c --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node.rs b/src/v1_25/api/core/v1/node.rs new file mode 100644 index 0000000000..5a5694b818 --- /dev/null +++ b/src/v1_25/api/core/v1/node.rs @@ -0,0 +1,1214 @@ +// 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, +} + +// Begin /v1/Node + +// Generated from operation connectCoreV1DeleteNodeProxy + +impl Node { + /// connect DELETE requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy( + name: &str, + optional: ConnectDeleteNodeProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeleteNodeProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_delete_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeleteNodeProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1DeleteNodeProxyWithPath + +impl Node { + /// connect DELETE requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy_with_path( + name: &str, + path: &str, + optional: ConnectDeleteNodeProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeleteNodeProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_delete_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeleteNodeProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNodeProxy + +impl Node { + /// connect GET requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy( + name: &str, + optional: ConnectGetNodeProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetNodeProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_get_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetNodeProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNodeProxyWithPath + +impl Node { + /// connect GET requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy_with_path( + name: &str, + path: &str, + optional: ConnectGetNodeProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetNodeProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_get_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetNodeProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNodeProxy + +impl Node { + /// connect PATCH requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy( + name: &str, + optional: ConnectPatchNodeProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchNodeProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_patch_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchNodeProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNodeProxyWithPath + +impl Node { + /// connect PATCH requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy_with_path( + name: &str, + path: &str, + optional: ConnectPatchNodeProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchNodeProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_patch_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchNodeProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNodeProxy + +impl Node { + /// connect POST requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy( + name: &str, + optional: ConnectPostNodeProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostNodeProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_post_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostNodeProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNodeProxyWithPath + +impl Node { + /// connect POST requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy_with_path( + name: &str, + path: &str, + optional: ConnectPostNodeProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostNodeProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_post_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostNodeProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNodeProxy + +impl Node { + /// connect PUT requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy( + name: &str, + optional: ConnectPutNodeProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutNodeProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_put_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutNodeProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNodeProxyWithPath + +impl Node { + /// connect PUT requests to proxy of Node + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NodeProxyOptions + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy_with_path( + name: &str, + path: &str, + optional: ConnectPutNodeProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutNodeProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/nodes/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Node::connect_put_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutNodeProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to node. + pub path_: Option<&'a str>, +} + +// Generated from operation createCoreV1Node + +impl Node { + /// create a Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::core::v1::Node, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/nodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNode + +impl Node { + /// delete collection of Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/api/v1/nodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1Node + +impl Node { + /// delete a Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1Node + +impl Node { + /// list or watch objects of kind Node + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/nodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1Node + +impl Node { + /// partially update the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NodeStatus + +impl Node { + /// partially update status of the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1Node + +impl Node { + /// read the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNodeResponse`]`>` constructor, or [`ReadNodeResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Node::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNodeResponse { + Ok(crate::api::core::v1::Node), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNodeResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNodeResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNodeResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NodeStatus + +impl Node { + /// read status of the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNodeStatusResponse`]`>` constructor, or [`ReadNodeStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Node::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNodeStatusResponse { + Ok(crate::api::core::v1::Node), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNodeStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNodeStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNodeStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1Node + +impl Node { + /// replace the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::core::v1::Node, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NodeStatus + +impl Node { + /// replace status of the specified Node + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Node + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::core::v1::Node, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/nodes/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1Node + +impl Node { + /// list or watch objects of kind Node + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/nodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Node + +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_25/api/core/v1/node_address.rs b/src/v1_25/api/core/v1/node_address.rs new file mode 100644 index 0000000000..b5c913a44e --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node_affinity.rs b/src/v1_25/api/core/v1/node_affinity.rs new file mode 100644 index 0000000000..2a70de8703 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/node_condition.rs b/src/v1_25/api/core/v1/node_condition.rs new file mode 100644 index 0000000000..5117fb26bf --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node_config_source.rs b/src/v1_25/api/core/v1/node_config_source.rs new file mode 100644 index 0000000000..baa5cd1a5b --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node_config_status.rs b/src/v1_25/api/core/v1/node_config_status.rs new file mode 100644 index 0000000000..ebd731c42f --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node_daemon_endpoints.rs b/src/v1_25/api/core/v1/node_daemon_endpoints.rs new file mode 100644 index 0000000000..656ba6b909 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/node_selector.rs b/src/v1_25/api/core/v1/node_selector.rs new file mode 100644 index 0000000000..5b146c615e --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/node_selector_requirement.rs b/src/v1_25/api/core/v1/node_selector_requirement.rs new file mode 100644 index 0000000000..57817f1fab --- /dev/null +++ b/src/v1_25/api/core/v1/node_selector_requirement.rs @@ -0,0 +1,186 @@ +// 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::DeepMerge::merge_from(&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.\n\n".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_25/api/core/v1/node_selector_term.rs b/src/v1_25/api/core/v1/node_selector_term.rs new file mode 100644 index 0000000000..b0d28cc176 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.match_expressions, other.match_expressions); + crate::DeepMerge::merge_from(&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_25/api/core/v1/node_spec.rs b/src/v1_25/api/core/v1/node_spec.rs new file mode 100644 index 0000000000..bb4073b039 --- /dev/null +++ b/src/v1_25/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 from Kubelets as of 1.24 and will be fully removed in 1.26. + 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::DeepMerge::merge_from(&mut self.pod_cidrs, other.pod_cidrs); + crate::DeepMerge::merge_from(&mut self.provider_id, other.provider_id); + crate::DeepMerge::merge_from(&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 from Kubelets as of 1.24 and will be fully removed in 1.26.".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_25/api/core/v1/node_status.rs b/src/v1_25/api/core/v1/node_status.rs new file mode 100644 index 0000000000..79f0d56439 --- /dev/null +++ b/src/v1_25/api/core/v1/node_status.rs @@ -0,0 +1,411 @@ +// 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 http://pr.k8s.io/79391 for an example. + 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, + + /// 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::DeepMerge::merge_from(&mut self.addresses, other.addresses); + crate::DeepMerge::merge_from(&mut self.allocatable, other.allocatable); + crate::DeepMerge::merge_from(&mut self.capacity, other.capacity); + crate::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.config, other.config); + crate::DeepMerge::merge_from(&mut self.daemon_endpoints, other.daemon_endpoints); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.volumes_attached, other.volumes_attached); + crate::DeepMerge::merge_from(&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_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, + "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_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_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, + 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", + "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.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.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 http://pr.k8s.io/79391 for an example.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(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.\n\n".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..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_25/api/core/v1/node_system_info.rs b/src/v1_25/api/core/v1/node_system_info.rs new file mode 100644 index 0000000000..71af573ca8 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/object_field_selector.rs b/src/v1_25/api/core/v1/object_field_selector.rs new file mode 100644 index 0000000000..093a425d36 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/object_reference.rs b/src/v1_25/api/core/v1/object_reference.rs new file mode 100644 index 0000000000..57c4436751 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/persistent_volume.rs b/src/v1_25/api/core/v1/persistent_volume.rs new file mode 100644 index 0000000000..c3d9dde5a2 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume.rs @@ -0,0 +1,734 @@ +// 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, +} + +// Begin /v1/PersistentVolume + +// Generated from operation createCoreV1PersistentVolume + +impl PersistentVolume { + /// create a PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::core::v1::PersistentVolume, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/persistentvolumes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionPersistentVolume + +impl PersistentVolume { + /// delete collection of PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/api/v1/persistentvolumes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1PersistentVolume + +impl PersistentVolume { + /// delete a PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1PersistentVolume + +impl PersistentVolume { + /// list or watch objects of kind PersistentVolume + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/persistentvolumes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1PersistentVolume + +impl PersistentVolume { + /// partially update the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1PersistentVolumeStatus + +impl PersistentVolume { + /// partially update status of the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1PersistentVolume + +impl PersistentVolume { + /// read the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPersistentVolumeResponse`]`>` constructor, or [`ReadPersistentVolumeResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PersistentVolume::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPersistentVolumeResponse { + Ok(crate::api::core::v1::PersistentVolume), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPersistentVolumeResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPersistentVolumeResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPersistentVolumeResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1PersistentVolumeStatus + +impl PersistentVolume { + /// read status of the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPersistentVolumeStatusResponse`]`>` constructor, or [`ReadPersistentVolumeStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PersistentVolume::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPersistentVolumeStatusResponse { + Ok(crate::api::core::v1::PersistentVolume), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPersistentVolumeStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPersistentVolumeStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPersistentVolumeStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1PersistentVolume + +impl PersistentVolume { + /// replace the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::core::v1::PersistentVolume, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1PersistentVolumeStatus + +impl PersistentVolume { + /// replace status of the specified PersistentVolume + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolume + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::core::v1::PersistentVolume, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/persistentvolumes/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1PersistentVolume + +impl PersistentVolume { + /// list or watch objects of kind PersistentVolume + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/persistentvolumes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/PersistentVolume + +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_25/api/core/v1/persistent_volume_claim.rs b/src/v1_25/api/core/v1/persistent_volume_claim.rs new file mode 100644 index 0000000000..e882129db9 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_claim.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin /v1/PersistentVolumeClaim + +// Generated from operation createCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// create a PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::PersistentVolumeClaim, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// delete collection of PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// delete a PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// list or watch objects of kind PersistentVolumeClaim + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1PersistentVolumeClaimForAllNamespaces + +impl PersistentVolumeClaim { + /// list or watch objects of kind PersistentVolumeClaim + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/persistentvolumeclaims?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// partially update the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPersistentVolumeClaimStatus + +impl PersistentVolumeClaim { + /// partially update status of the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// read the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPersistentVolumeClaimResponse`]`>` constructor, or [`ReadPersistentVolumeClaimResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PersistentVolumeClaim::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPersistentVolumeClaimResponse { + Ok(crate::api::core::v1::PersistentVolumeClaim), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPersistentVolumeClaimResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPersistentVolumeClaimResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPersistentVolumeClaimResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedPersistentVolumeClaimStatus + +impl PersistentVolumeClaim { + /// read status of the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPersistentVolumeClaimStatusResponse`]`>` constructor, or [`ReadPersistentVolumeClaimStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PersistentVolumeClaim::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPersistentVolumeClaimStatusResponse { + Ok(crate::api::core::v1::PersistentVolumeClaim), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPersistentVolumeClaimStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPersistentVolumeClaimStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPersistentVolumeClaimStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// replace the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::PersistentVolumeClaim, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedPersistentVolumeClaimStatus + +impl PersistentVolumeClaim { + /// replace status of the specified PersistentVolumeClaim + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PersistentVolumeClaim + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::core::v1::PersistentVolumeClaim, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedPersistentVolumeClaim + +impl PersistentVolumeClaim { + /// list or watch objects of kind PersistentVolumeClaim + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/persistentvolumeclaims?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1PersistentVolumeClaimForAllNamespaces + +impl PersistentVolumeClaim { + /// list or watch objects of kind PersistentVolumeClaim + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/persistentvolumeclaims?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/PersistentVolumeClaim + +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_25/api/core/v1/persistent_volume_claim_condition.rs b/src/v1_25/api/core/v1/persistent_volume_claim_condition.rs new file mode 100644 index 0000000000..1866f0a156 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_claim_condition.rs @@ -0,0 +1,241 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimCondition + +/// PersistentVolumeClaimCondition contails 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 "ResizeStarted" 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 contails 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 \"ResizeStarted\" 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_25/api/core/v1/persistent_volume_claim_spec.rs b/src/v1_25/api/core/v1/persistent_volume_claim_spec.rs new file mode 100644 index 0000000000..d43bb08405 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_claim_spec.rs @@ -0,0 +1,316 @@ +// 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. If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field. + 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 local 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, 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. There are two 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. + /// (Beta) Using this field requires the AnyVolumeDataSource 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, + + /// 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::DeepMerge::merge_from(&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_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_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, + "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_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_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_mode: value_volume_mode, + volume_name: value_volume_name, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimSpec", + &[ + "accessModes", + "dataSource", + "dataSourceRef", + "resources", + "selector", + "storageClassName", + "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_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_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. If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field.".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 local 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, 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. There are two 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(Beta) Using this field requires the AnyVolumeDataSource 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() + }), + ), + ( + "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_25/api/core/v1/persistent_volume_claim_status.rs b/src/v1_25/api/core/v1/persistent_volume_claim_status.rs new file mode 100644 index 0000000000..8f5f980671 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_claim_status.rs @@ -0,0 +1,274 @@ +// 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>, + + /// allocatedResources is the storage resource within AllocatedResources tracks the capacity allocated to a PVC. It 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. 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 'ResizeStarted'. + pub conditions: Option>, + + /// phase represents the current phase of PersistentVolumeClaim. + /// + pub phase: Option, + + /// resizeStatus stores status of resize operation. ResizeStatus is not set by default but when expansion is complete resizeStatus is set to empty string by resize controller or kubelet. This is an alpha field and requires enabling RecoverVolumeExpansionFailure feature. + pub resize_status: Option, +} + +impl crate::DeepMerge for PersistentVolumeClaimStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.access_modes, other.access_modes); + crate::DeepMerge::merge_from(&mut self.allocated_resources, other.allocated_resources); + crate::DeepMerge::merge_from(&mut self.capacity, other.capacity); + crate::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + crate::DeepMerge::merge_from(&mut self.resize_status, other.resize_status); + } +} + +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_resources, + Key_capacity, + Key_conditions, + Key_phase, + Key_resize_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 { + "accessModes" => Field::Key_access_modes, + "allocatedResources" => Field::Key_allocated_resources, + "capacity" => Field::Key_capacity, + "conditions" => Field::Key_conditions, + "phase" => Field::Key_phase, + "resizeStatus" => Field::Key_resize_status, + _ => 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_resources: Option> = None; + let mut value_capacity: Option> = None; + let mut value_conditions: Option> = None; + let mut value_phase: Option = None; + let mut value_resize_status: 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_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_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resize_status => value_resize_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(PersistentVolumeClaimStatus { + access_modes: value_access_modes, + allocated_resources: value_allocated_resources, + capacity: value_capacity, + conditions: value_conditions, + phase: value_phase, + resize_status: value_resize_status, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimStatus", + &[ + "accessModes", + "allocatedResources", + "capacity", + "conditions", + "phase", + "resizeStatus", + ], + 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_resources.as_ref().map_or(0, |_| 1) + + self.capacity.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1) + + self.resize_status.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_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.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + if let Some(value) = &self.resize_status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resizeStatus", 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() + }), + ), + ( + "allocatedResources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allocatedResources is the storage resource within AllocatedResources tracks the capacity allocated to a PVC. It 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. This 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 'ResizeStarted'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(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 represents the current phase of PersistentVolumeClaim.\n\n".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resizeStatus".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resizeStatus stores status of resize operation. ResizeStatus is not set by default but when expansion is complete resizeStatus is set to empty string by resize controller or kubelet. This 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::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/core/v1/persistent_volume_claim_template.rs b/src/v1_25/api/core/v1/persistent_volume_claim_template.rs new file mode 100644 index 0000000000..ea6af7233a --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/persistent_volume_claim_volume_source.rs b/src/v1_25/api/core/v1/persistent_volume_claim_volume_source.rs new file mode 100644 index 0000000000..a80c2ee70c --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/persistent_volume_spec.rs b/src/v1_25/api/core/v1/persistent_volume_spec.rs new file mode 100644 index 0000000000..42cd7fd388 --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_spec.rs @@ -0,0 +1,875 @@ +// 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, + + /// 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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.capacity, other.capacity); + 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::DeepMerge::merge_from(&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_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_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, + "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_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_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_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", + "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_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_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\n\n".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) + }, + ), + ( + "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_25/api/core/v1/persistent_volume_status.rs b/src/v1_25/api/core/v1/persistent_volume_status.rs new file mode 100644 index 0000000000..087f9fb05c --- /dev/null +++ b/src/v1_25/api/core/v1/persistent_volume_status.rs @@ -0,0 +1,178 @@ +// 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 { + /// 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.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_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 { + "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_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_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 { + message: value_message, + phase: value_phase, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeStatus", + &[ + "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.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.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: [ + ( + "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\n\n".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_25/api/core/v1/photon_persistent_disk_volume_source.rs b/src/v1_25/api/core/v1/photon_persistent_disk_volume_source.rs new file mode 100644 index 0000000000..3fbf3e5767 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/pod.rs b/src/v1_25/api/core/v1/pod.rs new file mode 100644 index 0000000000..f99a63faa1 --- /dev/null +++ b/src/v1_25/api/core/v1/pod.rs @@ -0,0 +1,2141 @@ +// 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, +} + +// Begin /v1/Pod + +// Generated from operation connectCoreV1DeleteNamespacedPodProxy + +impl Pod { + /// connect DELETE requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy( + name: &str, + namespace: &str, + optional: ConnectDeletePodProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeletePodProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_delete_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeletePodProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1DeleteNamespacedPodProxyWithPath + +impl Pod { + /// connect DELETE requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectDeletePodProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeletePodProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_delete_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeletePodProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNamespacedPodAttach + +impl Pod { + /// connect GET requests to attach of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodAttachOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_attach( + name: &str, + namespace: &str, + optional: ConnectGetPodAttachOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetPodAttachOptional { + container, + stderr, + stdin, + stdout, + tty, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/attach?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(container) = container { + __query_pairs.append_pair("container", container); + } + if let Some(stderr) = stderr { + __query_pairs.append_pair("stderr", if stderr { "true" } else { "false" }); + } + if let Some(stdin) = stdin { + __query_pairs.append_pair("stdin", if stdin { "true" } else { "false" }); + } + if let Some(stdout) = stdout { + __query_pairs.append_pair("stdout", if stdout { "true" } else { "false" }); + } + if let Some(tty) = tty { + __query_pairs.append_pair("tty", if tty { "true" } else { "false" }); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_get_attach`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetPodAttachOptional<'a> { + /// The container in which to execute the command. Defaults to only container if there is only one container in the pod. + pub container: Option<&'a str>, + /// Stderr if true indicates that stderr is to be redirected for the attach call. Defaults to true. + pub stderr: Option, + /// Stdin if true, redirects the standard input stream of the pod for this call. Defaults to false. + pub stdin: Option, + /// Stdout if true indicates that stdout is to be redirected for the attach call. Defaults to true. + pub stdout: Option, + /// TTY if true indicates that a tty will be allocated for the attach call. This is passed through the container runtime so the tty is allocated on the worker node by the container runtime. Defaults to false. + pub tty: Option, +} + +// Generated from operation connectCoreV1GetNamespacedPodExec + +impl Pod { + /// connect GET requests to exec of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodExecOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_exec( + name: &str, + namespace: &str, + optional: ConnectGetPodExecOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetPodExecOptional { + command, + container, + stderr, + stdin, + stdout, + tty, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/exec?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(command) = command { + for command in command { + __query_pairs.append_pair("command", command); + } + } + if let Some(container) = container { + __query_pairs.append_pair("container", container); + } + if let Some(stderr) = stderr { + __query_pairs.append_pair("stderr", if stderr { "true" } else { "false" }); + } + if let Some(stdin) = stdin { + __query_pairs.append_pair("stdin", if stdin { "true" } else { "false" }); + } + if let Some(stdout) = stdout { + __query_pairs.append_pair("stdout", if stdout { "true" } else { "false" }); + } + if let Some(tty) = tty { + __query_pairs.append_pair("tty", if tty { "true" } else { "false" }); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_get_exec`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetPodExecOptional<'a> { + /// Command is the remote command to execute. argv array. Not executed within a shell. + pub command: Option<&'a [String]>, + /// Container in which to execute the command. Defaults to only container if there is only one container in the pod. + pub container: Option<&'a str>, + /// Redirect the standard error stream of the pod for this call. + pub stderr: Option, + /// Redirect the standard input stream of the pod for this call. Defaults to false. + pub stdin: Option, + /// Redirect the standard output stream of the pod for this call. + pub stdout: Option, + /// TTY if true indicates that a tty will be allocated for the exec call. Defaults to false. + pub tty: Option, +} + +// Generated from operation connectCoreV1GetNamespacedPodPortforward + +impl Pod { + /// connect GET requests to portforward of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodPortForwardOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_portforward( + name: &str, + namespace: &str, + optional: ConnectGetPodPortforwardOptional, + ) -> Result>, crate::RequestError> { + let ConnectGetPodPortforwardOptional { + ports, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/portforward?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(ports) = ports { + __query_pairs.append_pair("ports", &ports.to_string()); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_get_portforward`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetPodPortforwardOptional { + /// List of ports to forward Required when using WebSockets + pub ports: Option, +} + +// Generated from operation connectCoreV1GetNamespacedPodProxy + +impl Pod { + /// connect GET requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy( + name: &str, + namespace: &str, + optional: ConnectGetPodProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetPodProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_get_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetPodProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNamespacedPodProxyWithPath + +impl Pod { + /// connect GET requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectGetPodProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetPodProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_get_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetPodProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNamespacedPodProxy + +impl Pod { + /// connect PATCH requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy( + name: &str, + namespace: &str, + optional: ConnectPatchPodProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchPodProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_patch_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchPodProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNamespacedPodProxyWithPath + +impl Pod { + /// connect PATCH requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPatchPodProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchPodProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_patch_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchPodProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNamespacedPodAttach + +impl Pod { + /// connect POST requests to attach of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodAttachOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_attach( + name: &str, + namespace: &str, + optional: ConnectPostPodAttachOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostPodAttachOptional { + container, + stderr, + stdin, + stdout, + tty, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/attach?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(container) = container { + __query_pairs.append_pair("container", container); + } + if let Some(stderr) = stderr { + __query_pairs.append_pair("stderr", if stderr { "true" } else { "false" }); + } + if let Some(stdin) = stdin { + __query_pairs.append_pair("stdin", if stdin { "true" } else { "false" }); + } + if let Some(stdout) = stdout { + __query_pairs.append_pair("stdout", if stdout { "true" } else { "false" }); + } + if let Some(tty) = tty { + __query_pairs.append_pair("tty", if tty { "true" } else { "false" }); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_post_attach`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostPodAttachOptional<'a> { + /// The container in which to execute the command. Defaults to only container if there is only one container in the pod. + pub container: Option<&'a str>, + /// Stderr if true indicates that stderr is to be redirected for the attach call. Defaults to true. + pub stderr: Option, + /// Stdin if true, redirects the standard input stream of the pod for this call. Defaults to false. + pub stdin: Option, + /// Stdout if true indicates that stdout is to be redirected for the attach call. Defaults to true. + pub stdout: Option, + /// TTY if true indicates that a tty will be allocated for the attach call. This is passed through the container runtime so the tty is allocated on the worker node by the container runtime. Defaults to false. + pub tty: Option, +} + +// Generated from operation connectCoreV1PostNamespacedPodExec + +impl Pod { + /// connect POST requests to exec of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodExecOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_exec( + name: &str, + namespace: &str, + optional: ConnectPostPodExecOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostPodExecOptional { + command, + container, + stderr, + stdin, + stdout, + tty, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/exec?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(command) = command { + __query_pairs.append_pair("command", command); + } + if let Some(container) = container { + __query_pairs.append_pair("container", container); + } + if let Some(stderr) = stderr { + __query_pairs.append_pair("stderr", if stderr { "true" } else { "false" }); + } + if let Some(stdin) = stdin { + __query_pairs.append_pair("stdin", if stdin { "true" } else { "false" }); + } + if let Some(stdout) = stdout { + __query_pairs.append_pair("stdout", if stdout { "true" } else { "false" }); + } + if let Some(tty) = tty { + __query_pairs.append_pair("tty", if tty { "true" } else { "false" }); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_post_exec`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostPodExecOptional<'a> { + /// Command is the remote command to execute. argv array. Not executed within a shell. + pub command: Option<&'a str>, + /// Container in which to execute the command. Defaults to only container if there is only one container in the pod. + pub container: Option<&'a str>, + /// Redirect the standard error stream of the pod for this call. + pub stderr: Option, + /// Redirect the standard input stream of the pod for this call. Defaults to false. + pub stdin: Option, + /// Redirect the standard output stream of the pod for this call. + pub stdout: Option, + /// TTY if true indicates that a tty will be allocated for the exec call. Defaults to false. + pub tty: Option, +} + +// Generated from operation connectCoreV1PostNamespacedPodPortforward + +impl Pod { + /// connect POST requests to portforward of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodPortForwardOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_portforward( + name: &str, + namespace: &str, + optional: ConnectPostPodPortforwardOptional, + ) -> Result>, crate::RequestError> { + let ConnectPostPodPortforwardOptional { + ports, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/portforward?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(ports) = ports { + __query_pairs.append_pair("ports", &ports.to_string()); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_post_portforward`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostPodPortforwardOptional { + /// List of ports to forward Required when using WebSockets + pub ports: Option, +} + +// Generated from operation connectCoreV1PostNamespacedPodProxy + +impl Pod { + /// connect POST requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy( + name: &str, + namespace: &str, + optional: ConnectPostPodProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostPodProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_post_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostPodProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNamespacedPodProxyWithPath + +impl Pod { + /// connect POST requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPostPodProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostPodProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_post_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostPodProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNamespacedPodProxy + +impl Pod { + /// connect PUT requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy( + name: &str, + namespace: &str, + optional: ConnectPutPodProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutPodProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_put_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutPodProxyOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNamespacedPodProxyWithPath + +impl Pod { + /// connect PUT requests to proxy of Pod + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPutPodProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutPodProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Pod::connect_put_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutPodProxyWithPathOptional<'a> { + /// Path is the URL path to use for the current proxy request to pod. + pub path_: Option<&'a str>, +} + +// Generated from operation createCoreV1NamespacedPod + +impl Pod { + /// create a Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Pod, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedPod + +impl Pod { + /// delete collection of Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedPod + +impl Pod { + /// delete a Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedPod + +impl Pod { + /// list or watch objects of kind Pod + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1PodForAllNamespaces + +impl Pod { + /// list or watch objects of kind Pod + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/pods?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPod + +impl Pod { + /// partially update the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPodEphemeralcontainers + +impl Pod { + /// partially update ephemeralcontainers of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_ephemeralcontainers( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPodStatus + +impl Pod { + /// partially update status of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedPod + +impl Pod { + /// read the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodResponse`]`>` constructor, or [`ReadPodResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Pod::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodResponse { + Ok(crate::api::core::v1::Pod), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedPodEphemeralcontainers + +impl Pod { + /// read ephemeralcontainers of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodEphemeralcontainersResponse`]`>` constructor, or [`ReadPodEphemeralcontainersResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_ephemeralcontainers( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Pod::read_ephemeralcontainers`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodEphemeralcontainersResponse { + Ok(crate::api::core::v1::Pod), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodEphemeralcontainersResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodEphemeralcontainersResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodEphemeralcontainersResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedPodLog + +impl Pod { + /// read log of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodLogResponse`]`>` constructor, or [`ReadPodLogResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn read_log( + name: &str, + namespace: &str, + optional: ReadPodLogOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let ReadPodLogOptional { + container, + follow, + insecure_skip_tls_verify_backend, + limit_bytes, + previous, + since_seconds, + tail_lines, + timestamps, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/log?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(container) = container { + __query_pairs.append_pair("container", container); + } + if let Some(follow) = follow { + __query_pairs.append_pair("follow", if follow { "true" } else { "false" }); + } + if let Some(insecure_skip_tls_verify_backend) = insecure_skip_tls_verify_backend { + __query_pairs.append_pair("insecureSkipTLSVerifyBackend", if insecure_skip_tls_verify_backend { "true" } else { "false" }); + } + if let Some(limit_bytes) = limit_bytes { + __query_pairs.append_pair("limitBytes", &limit_bytes.to_string()); + } + if let Some(previous) = previous { + __query_pairs.append_pair("previous", if previous { "true" } else { "false" }); + } + if let Some(since_seconds) = since_seconds { + __query_pairs.append_pair("sinceSeconds", &since_seconds.to_string()); + } + if let Some(tail_lines) = tail_lines { + __query_pairs.append_pair("tailLines", &tail_lines.to_string()); + } + if let Some(timestamps) = timestamps { + __query_pairs.append_pair("timestamps", if timestamps { "true" } else { "false" }); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Optional parameters of [`Pod::read_log`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ReadPodLogOptional<'a> { + /// The container for which to stream logs. Defaults to only container if there is one container in the pod. + pub container: Option<&'a str>, + /// Follow the log stream of the pod. Defaults to false. + pub follow: Option, + /// insecureSkipTLSVerifyBackend indicates that the apiserver should not confirm the validity of the serving certificate of the backend it is connecting to. This will make the HTTPS connection between the apiserver and the backend insecure. This means the apiserver cannot verify the log data it is receiving came from the real kubelet. If the kubelet is configured to verify the apiserver's TLS credentials, it does not mean the connection to the real kubelet is vulnerable to a man in the middle attack (e.g. an attacker could not intercept the actual log data coming from the real kubelet). + pub insecure_skip_tls_verify_backend: Option, + /// If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit. + pub limit_bytes: Option, + /// Return previous terminated container logs. Defaults to false. + pub previous: Option, + /// A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified. + pub since_seconds: Option, + /// If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime + pub tail_lines: Option, + /// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false. + pub timestamps: Option, +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Pod::read_log`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodLogResponse { + Ok(String), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodLogResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + if buf.is_empty() { + return Err(crate::ResponseError::NeedMoreData); + } + + let (result, len) = match std::str::from_utf8(buf) { + Ok(s) => (s, buf.len()), + Err(err) => match (err.valid_up_to(), err.error_len()) { + (0, Some(_)) => return Err(crate::ResponseError::Utf8(err)), + (0, None) => return Err(crate::ResponseError::NeedMoreData), + (valid_up_to, _) => ( + unsafe { std::str::from_utf8_unchecked(buf.get_unchecked(..valid_up_to)) }, + valid_up_to, + ), + }, + }; + Ok((ReadPodLogResponse::Ok(result.to_owned()), len)) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodLogResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedPodStatus + +impl Pod { + /// read status of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodStatusResponse`]`>` constructor, or [`ReadPodStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Pod::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodStatusResponse { + Ok(crate::api::core::v1::Pod), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedPod + +impl Pod { + /// replace the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Pod, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedPodEphemeralcontainers + +impl Pod { + /// replace ephemeralcontainers of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_ephemeralcontainers( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Pod, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedPodStatus + +impl Pod { + /// replace status of the specified Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Pod + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Pod, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedPod + +impl Pod { + /// list or watch objects of kind Pod + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1PodForAllNamespaces + +impl Pod { + /// list or watch objects of kind Pod + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/pods?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Pod + +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_25/api/core/v1/pod_affinity.rs b/src/v1_25/api/core/v1/pod_affinity.rs new file mode 100644 index 0000000000..facc781ff6 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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 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_25/api/core/v1/pod_affinity_term.rs b/src/v1_25/api/core/v1/pod_affinity_term.rs new file mode 100644 index 0000000000..92b8e14b28 --- /dev/null +++ b/src/v1_25/api/core/v1/pod_affinity_term.rs @@ -0,0 +1,212 @@ +// 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. + pub label_selector: 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::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&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_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, + "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_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_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, + namespace_selector: value_namespace_selector, + namespaces: value_namespaces, + topology_key: value_topology_key.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodAffinityTerm", + &[ + "labelSelector", + "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.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.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.".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("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_25/api/core/v1/pod_anti_affinity.rs b/src/v1_25/api/core/v1/pod_anti_affinity.rs new file mode 100644 index 0000000000..a6cd6aa584 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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 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_25/api/core/v1/pod_condition.rs b/src/v1_25/api/core/v1/pod_condition.rs new file mode 100644 index 0000000000..7b78db671a --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/pod_dns_config.rs b/src/v1_25/api/core/v1/pod_dns_config.rs new file mode 100644 index 0000000000..b79282bb55 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.nameservers, other.nameservers); + crate::DeepMerge::merge_from(&mut self.options, other.options); + crate::DeepMerge::merge_from(&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_25/api/core/v1/pod_dns_config_option.rs b/src/v1_25/api/core/v1/pod_dns_config_option.rs new file mode 100644 index 0000000000..86bd374504 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/pod_ip.rs b/src/v1_25/api/core/v1/pod_ip.rs new file mode 100644 index 0000000000..1ea9bb4386 --- /dev/null +++ b/src/v1_25/api/core/v1/pod_ip.rs @@ -0,0 +1,129 @@ +// Generated from definition io.k8s.api.core.v1.PodIP + +/// IP address information for entries in the (plural) PodIPs field. Each entry includes: +/// +/// IP: An IP address allocated to the pod. Routable at least within the cluster. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodIP { + /// ip is an IP address (IPv4 or IPv6) 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("IP address information for entries in the (plural) PodIPs field. Each entry includes:\n\n\tIP: An IP address allocated to the pod. Routable at least within the 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: [ + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ip is an IP address (IPv4 or IPv6) 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_25/api/core/v1/pod_os.rs b/src/v1_25/api/core/v1/pod_os.rs new file mode 100644 index 0000000000..0ca8f9660b --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/pod_readiness_gate.rs b/src/v1_25/api/core/v1/pod_readiness_gate.rs new file mode 100644 index 0000000000..3d9f768444 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/pod_security_context.rs b/src/v1_25/api/core/v1/pod_security_context.rs new file mode 100644 index 0000000000..9cf93e3f01 --- /dev/null +++ b/src/v1_25/api/core/v1/pod_security_context.rs @@ -0,0 +1,373 @@ +// 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 { + /// 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. If unspecified, no groups will be added to any container. 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.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::DeepMerge::merge_from(&mut self.supplemental_groups, other.supplemental_groups); + crate::DeepMerge::merge_from(&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_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 { + "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_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_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 { + 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", + &[ + "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.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.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: [ + ( + "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. If unspecified, no groups will be added to any 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::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_25/api/core/v1/pod_spec.rs b/src/v1_25/api/core/v1/pod_spec.rs new file mode 100644 index 0000000000..ef1f76e7d4 --- /dev/null +++ b/src/v1_25/api/core/v1/pod_spec.rs @@ -0,0 +1,1086 @@ +// 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. This is only valid for non-hostNetwork pods. + 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.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.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>, + + /// Restart policy for all containers within the pod. One of Always, OnFailure, Never. 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, + + /// 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 depreciated 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::DeepMerge::merge_from(&mut self.containers, other.containers); + 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::DeepMerge::merge_from(&mut self.ephemeral_containers, other.ephemeral_containers); + crate::DeepMerge::merge_from(&mut self.host_aliases, other.host_aliases); + 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::DeepMerge::merge_from(&mut self.image_pull_secrets, other.image_pull_secrets); + crate::DeepMerge::merge_from(&mut self.init_containers, other.init_containers); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::DeepMerge::merge_from(&mut self.node_selector, other.node_selector); + crate::DeepMerge::merge_from(&mut self.os, other.os); + crate::DeepMerge::merge_from(&mut self.overhead, other.overhead); + 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::DeepMerge::merge_from(&mut self.readiness_gates, other.readiness_gates); + 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::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::DeepMerge::merge_from(&mut self.tolerations, other.tolerations); + crate::DeepMerge::merge_from(&mut self.topology_spread_constraints, other.topology_spread_constraints); + crate::DeepMerge::merge_from(&mut self.volumes, other.volumes); + } +} + +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_restart_policy, + Key_runtime_class_name, + Key_scheduler_name, + 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, + "restartPolicy" => Field::Key_restart_policy, + "runtimeClassName" => Field::Key_runtime_class_name, + "schedulerName" => Field::Key_scheduler_name, + "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_restart_policy: Option = None; + let mut value_runtime_class_name: Option = None; + let mut value_scheduler_name: 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_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_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, + restart_policy: value_restart_policy, + runtime_class_name: value_runtime_class_name, + scheduler_name: value_scheduler_name, + 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", + "restartPolicy", + "runtimeClassName", + "schedulerName", + "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.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.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.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.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'.\n\n".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. This is only valid for non-hostNetwork 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(__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.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.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() + }), + ), + ( + "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. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy\n\n".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() + }), + ), + ( + "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 depreciated 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_25/api/core/v1/pod_status.rs b/src/v1_25/api/core/v1/pod_status.rs new file mode 100644 index 0000000000..6f83dcb6f7 --- /dev/null +++ b/src/v1_25/api/core/v1/pod_status.rs @@ -0,0 +1,453 @@ +// 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>, + + /// IP address of the host to which the pod is assigned. Empty if not yet scheduled. + pub host_ip: 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, + + /// IP 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://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md + /// + pub qos_class: Option, + + /// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted' + pub reason: 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.container_statuses, other.container_statuses); + crate::DeepMerge::merge_from(&mut self.ephemeral_container_statuses, other.ephemeral_container_statuses); + crate::DeepMerge::merge_from(&mut self.host_ip, other.host_ip); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.pod_ips, other.pod_ips); + 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.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_init_container_statuses, + Key_message, + Key_nominated_node_name, + Key_phase, + Key_pod_ip, + Key_pod_ips, + Key_qos_class, + Key_reason, + 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, + "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, + "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_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_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_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_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, + 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, + start_time: value_start_time, + }) + } + } + + deserializer.deserialize_struct( + "PodStatus", + &[ + "conditions", + "containerStatuses", + "ephemeralContainerStatuses", + "hostIP", + "initContainerStatuses", + "message", + "nominatedNodeName", + "phase", + "podIP", + "podIPs", + "qosClass", + "reason", + "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.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.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.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.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("IP address of the host to which the pod is assigned. Empty if not yet scheduled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..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\n\n".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("IP 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://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md\n\n".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() + }), + ), + ( + "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_25/api/core/v1/pod_template.rs b/src/v1_25/api/core/v1/pod_template.rs new file mode 100644 index 0000000000..5ce465ce2e --- /dev/null +++ b/src/v1_25/api/core/v1/pod_template.rs @@ -0,0 +1,672 @@ +// 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, +} + +// Begin /v1/PodTemplate + +// Generated from operation createCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// create a PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::PodTemplate, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedPodTemplate + +impl PodTemplate { + /// delete collection of PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// delete a PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodTemplate + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// list or watch objects of kind PodTemplate + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1PodTemplateForAllNamespaces + +impl PodTemplate { + /// list or watch objects of kind PodTemplate + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/podtemplates?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// partially update the specified PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodTemplate + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// read the specified PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodTemplateResponse`]`>` constructor, or [`ReadPodTemplateResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodTemplate + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PodTemplate::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodTemplateResponse { + Ok(crate::api::core::v1::PodTemplate), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodTemplateResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodTemplateResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodTemplateResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// replace the specified PodTemplate + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodTemplate + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::PodTemplate, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedPodTemplate + +impl PodTemplate { + /// list or watch objects of kind PodTemplate + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/podtemplates?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1PodTemplateForAllNamespaces + +impl PodTemplate { + /// list or watch objects of kind PodTemplate + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/podtemplates?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/PodTemplate + +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_25/api/core/v1/pod_template_spec.rs b/src/v1_25/api/core/v1/pod_template_spec.rs new file mode 100644 index 0000000000..37df06ce13 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/port_status.rs b/src/v1_25/api/core/v1/port_status.rs new file mode 100644 index 0000000000..778a2f3ee4 --- /dev/null +++ b/src/v1_25/api/core/v1/port_status.rs @@ -0,0 +1,176 @@ +// 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\"\n\n".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_25/api/core/v1/portworx_volume_source.rs b/src/v1_25/api/core/v1/portworx_volume_source.rs new file mode 100644 index 0000000000..26a21ce6d6 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/preferred_scheduling_term.rs b/src/v1_25/api/core/v1/preferred_scheduling_term.rs new file mode 100644 index 0000000000..a14c07c75d --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/probe.rs b/src/v1_25/api/core/v1/probe.rs new file mode 100644 index 0000000000..f3d9f5405b --- /dev/null +++ b/src/v1_25/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. This is a beta field and requires enabling GRPCContainerProbe feature gate. + 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. This is a beta field and requires enabling GRPCContainerProbe feature gate.".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_25/api/core/v1/projected_volume_source.rs b/src/v1_25/api/core/v1/projected_volume_source.rs new file mode 100644 index 0000000000..8cbfa14727 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/quobyte_volume_source.rs b/src/v1_25/api/core/v1/quobyte_volume_source.rs new file mode 100644 index 0000000000..a5aa208eb3 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/rbd_persistent_volume_source.rs b/src/v1_25/api/core/v1/rbd_persistent_volume_source.rs new file mode 100644 index 0000000000..54b7b5e7f2 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/rbd_volume_source.rs b/src/v1_25/api/core/v1/rbd_volume_source.rs new file mode 100644 index 0000000000..2d39e78da8 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/replication_controller.rs b/src/v1_25/api/core/v1/replication_controller.rs new file mode 100644 index 0000000000..613bdd6f41 --- /dev/null +++ b/src/v1_25/api/core/v1/replication_controller.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin /v1/ReplicationController + +// Generated from operation createCoreV1NamespacedReplicationController + +impl ReplicationController { + /// create a ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::ReplicationController, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedReplicationController + +impl ReplicationController { + /// delete collection of ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedReplicationController + +impl ReplicationController { + /// delete a ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedReplicationController + +impl ReplicationController { + /// list or watch objects of kind ReplicationController + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1ReplicationControllerForAllNamespaces + +impl ReplicationController { + /// list or watch objects of kind ReplicationController + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/replicationcontrollers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedReplicationController + +impl ReplicationController { + /// partially update the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedReplicationControllerStatus + +impl ReplicationController { + /// partially update status of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedReplicationController + +impl ReplicationController { + /// read the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicationControllerResponse`]`>` constructor, or [`ReadReplicationControllerResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ReplicationController::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicationControllerResponse { + Ok(crate::api::core::v1::ReplicationController), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicationControllerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicationControllerResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicationControllerResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedReplicationControllerStatus + +impl ReplicationController { + /// read status of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadReplicationControllerStatusResponse`]`>` constructor, or [`ReadReplicationControllerStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ReplicationController::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadReplicationControllerStatusResponse { + Ok(crate::api::core::v1::ReplicationController), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadReplicationControllerStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadReplicationControllerStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadReplicationControllerStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedReplicationController + +impl ReplicationController { + /// replace the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ReplicationController, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedReplicationControllerStatus + +impl ReplicationController { + /// replace status of the specified ReplicationController + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ReplicationController + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ReplicationController, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedReplicationController + +impl ReplicationController { + /// list or watch objects of kind ReplicationController + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/replicationcontrollers?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1ReplicationControllerForAllNamespaces + +impl ReplicationController { + /// list or watch objects of kind ReplicationController + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/replicationcontrollers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/ReplicationController + +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_25/api/core/v1/replication_controller_condition.rs b/src/v1_25/api/core/v1/replication_controller_condition.rs new file mode 100644 index 0000000000..1686b2e4fd --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/replication_controller_spec.rs b/src/v1_25/api/core/v1/replication_controller_spec.rs new file mode 100644 index 0000000000..293546b183 --- /dev/null +++ b/src/v1_25/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. 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::DeepMerge::merge_from(&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. 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_25/api/core/v1/replication_controller_status.rs b/src/v1_25/api/core/v1/replication_controller_status.rs new file mode 100644 index 0000000000..d069722747 --- /dev/null +++ b/src/v1_25/api/core/v1/replication_controller_status.rs @@ -0,0 +1,262 @@ +// 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 oberved 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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 oberved 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_25/api/core/v1/resource_field_selector.rs b/src/v1_25/api/core/v1/resource_field_selector.rs new file mode 100644 index 0000000000..c2ca6d15bc --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/resource_quota.rs b/src/v1_25/api/core/v1/resource_quota.rs new file mode 100644 index 0000000000..fac2dbab5e --- /dev/null +++ b/src/v1_25/api/core/v1/resource_quota.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin /v1/ResourceQuota + +// Generated from operation createCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// create a ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::ResourceQuota, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedResourceQuota + +impl ResourceQuota { + /// delete collection of ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// delete a ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// list or watch objects of kind ResourceQuota + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1ResourceQuotaForAllNamespaces + +impl ResourceQuota { + /// list or watch objects of kind ResourceQuota + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/resourcequotas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// partially update the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedResourceQuotaStatus + +impl ResourceQuota { + /// partially update status of the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// read the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceQuotaResponse`]`>` constructor, or [`ReadResourceQuotaResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ResourceQuota::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadResourceQuotaResponse { + Ok(crate::api::core::v1::ResourceQuota), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadResourceQuotaResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadResourceQuotaResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadResourceQuotaResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedResourceQuotaStatus + +impl ResourceQuota { + /// read status of the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceQuotaStatusResponse`]`>` constructor, or [`ReadResourceQuotaStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ResourceQuota::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadResourceQuotaStatusResponse { + Ok(crate::api::core::v1::ResourceQuota), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadResourceQuotaStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadResourceQuotaStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadResourceQuotaStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// replace the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ResourceQuota, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedResourceQuotaStatus + +impl ResourceQuota { + /// replace status of the specified ResourceQuota + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ResourceQuota + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ResourceQuota, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedResourceQuota + +impl ResourceQuota { + /// list or watch objects of kind ResourceQuota + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/resourcequotas?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1ResourceQuotaForAllNamespaces + +impl ResourceQuota { + /// list or watch objects of kind ResourceQuota + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/resourcequotas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/ResourceQuota + +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_25/api/core/v1/resource_quota_spec.rs b/src/v1_25/api/core/v1/resource_quota_spec.rs new file mode 100644 index 0000000000..fab2b7970d --- /dev/null +++ b/src/v1_25/api/core/v1/resource_quota_spec.rs @@ -0,0 +1,190 @@ +// 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::DeepMerge::merge_from(&mut self.hard, other.hard); + crate::DeepMerge::merge_from(&mut self.scope_selector, other.scope_selector); + crate::DeepMerge::merge_from(&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_25/api/core/v1/resource_quota_status.rs b/src/v1_25/api/core/v1/resource_quota_status.rs new file mode 100644 index 0000000000..100f418a69 --- /dev/null +++ b/src/v1_25/api/core/v1/resource_quota_status.rs @@ -0,0 +1,160 @@ +// 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::DeepMerge::merge_from(&mut self.hard, other.hard); + crate::DeepMerge::merge_from(&mut self.used, other.used); + } +} + +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_25/api/core/v1/resource_requirements.rs b/src/v1_25/api/core/v1/resource_requirements.rs new file mode 100644 index 0000000000..816608c415 --- /dev/null +++ b/src/v1_25/api/core/v1/resource_requirements.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.core.v1.ResourceRequirements + +/// ResourceRequirements describes the compute resource requirements. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceRequirements { + /// 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. 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::DeepMerge::merge_from(&mut self.limits, other.limits); + crate::DeepMerge::merge_from(&mut self.requests, other.requests); + } +} + +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_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 = 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_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(ResourceRequirements { + limits: value_limits, + requests: value_requests, + }) + } + } + + deserializer.deserialize_struct( + "ResourceRequirements", + &[ + "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.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 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: [ + ( + "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. 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_25/api/core/v1/scale_io_persistent_volume_source.rs b/src/v1_25/api/core/v1/scale_io_persistent_volume_source.rs new file mode 100644 index 0000000000..c55a4d5990 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/scale_io_volume_source.rs b/src/v1_25/api/core/v1/scale_io_volume_source.rs new file mode 100644 index 0000000000..1729f3869a --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/scope_selector.rs b/src/v1_25/api/core/v1/scope_selector.rs new file mode 100644 index 0000000000..22ef180aeb --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/scoped_resource_selector_requirement.rs b/src/v1_25/api/core/v1/scoped_resource_selector_requirement.rs new file mode 100644 index 0000000000..14449d761a --- /dev/null +++ b/src/v1_25/api/core/v1/scoped_resource_selector_requirement.rs @@ -0,0 +1,187 @@ +// 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::DeepMerge::merge_from(&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.\n\n".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.\n\n".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_25/api/core/v1/se_linux_options.rs b/src/v1_25/api/core/v1/se_linux_options.rs new file mode 100644 index 0000000000..2a4969159f --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/seccomp_profile.rs b/src/v1_25/api/core/v1/seccomp_profile.rs new file mode 100644 index 0000000000..0622ab1e44 --- /dev/null +++ b/src/v1_25/api/core/v1/seccomp_profile.rs @@ -0,0 +1,156 @@ +// 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 only be set if type is "Localhost". + 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 only be set 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 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.\n\n".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_25/api/core/v1/secret.rs b/src/v1_25/api/core/v1/secret.rs new file mode 100644 index 0000000000..74a33ebe09 --- /dev/null +++ b/src/v1_25/api/core/v1/secret.rs @@ -0,0 +1,766 @@ +// 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, +} + +// Begin /v1/Secret + +// Generated from operation createCoreV1NamespacedSecret + +impl Secret { + /// create a Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Secret, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedSecret + +impl Secret { + /// delete collection of Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedSecret + +impl Secret { + /// delete a Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Secret + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedSecret + +impl Secret { + /// list or watch objects of kind Secret + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1SecretForAllNamespaces + +impl Secret { + /// list or watch objects of kind Secret + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/secrets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedSecret + +impl Secret { + /// partially update the specified Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Secret + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedSecret + +impl Secret { + /// read the specified Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadSecretResponse`]`>` constructor, or [`ReadSecretResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Secret + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Secret::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadSecretResponse { + Ok(crate::api::core::v1::Secret), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadSecretResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadSecretResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadSecretResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedSecret + +impl Secret { + /// replace the specified Secret + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Secret + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Secret, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedSecret + +impl Secret { + /// list or watch objects of kind Secret + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/secrets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1SecretForAllNamespaces + +impl Secret { + /// list or watch objects of kind Secret + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/secrets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Secret + +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::DeepMerge::merge_from(&mut self.data, other.data); + crate::DeepMerge::merge_from(&mut self.immutable, other.immutable); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.string_data, other.string_data); + 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_25/api/core/v1/secret_env_source.rs b/src/v1_25/api/core/v1/secret_env_source.rs new file mode 100644 index 0000000000..920f5519ab --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/secret_key_selector.rs b/src/v1_25/api/core/v1/secret_key_selector.rs new file mode 100644 index 0000000000..ba4f95d67f --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/secret_projection.rs b/src/v1_25/api/core/v1/secret_projection.rs new file mode 100644 index 0000000000..f32c8fac09 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/secret_reference.rs b/src/v1_25/api/core/v1/secret_reference.rs new file mode 100644 index 0000000000..1aa808fdc9 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/secret_volume_source.rs b/src/v1_25/api/core/v1/secret_volume_source.rs new file mode 100644 index 0000000000..9be0591abd --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/security_context.rs b/src/v1_25/api/core/v1/security_context.rs new file mode 100644 index 0000000000..2268be2bcf --- /dev/null +++ b/src/v1_25/api/core/v1/security_context.rs @@ -0,0 +1,379 @@ +// 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, + + /// 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.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_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, + "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_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_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, + 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", + "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.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.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() + }), + ), + ( + "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_25/api/core/v1/service.rs b/src/v1_25/api/core/v1/service.rs new file mode 100644 index 0000000000..d5b201c7a6 --- /dev/null +++ b/src/v1_25/api/core/v1/service.rs @@ -0,0 +1,1408 @@ +// 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, +} + +// Begin /v1/Service + +// Generated from operation connectCoreV1DeleteNamespacedServiceProxy + +impl Service { + /// connect DELETE requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy( + name: &str, + namespace: &str, + optional: ConnectDeleteServiceProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeleteServiceProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_delete_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeleteServiceProxyOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1DeleteNamespacedServiceProxyWithPath + +impl Service { + /// connect DELETE requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_delete_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectDeleteServiceProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectDeleteServiceProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_delete_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectDeleteServiceProxyWithPathOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNamespacedServiceProxy + +impl Service { + /// connect GET requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy( + name: &str, + namespace: &str, + optional: ConnectGetServiceProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetServiceProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_get_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetServiceProxyOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1GetNamespacedServiceProxyWithPath + +impl Service { + /// connect GET requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_get_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectGetServiceProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectGetServiceProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_get_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectGetServiceProxyWithPathOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNamespacedServiceProxy + +impl Service { + /// connect PATCH requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy( + name: &str, + namespace: &str, + optional: ConnectPatchServiceProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchServiceProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_patch_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchServiceProxyOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PatchNamespacedServiceProxyWithPath + +impl Service { + /// connect PATCH requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_patch_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPatchServiceProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPatchServiceProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_patch_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPatchServiceProxyWithPathOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNamespacedServiceProxy + +impl Service { + /// connect POST requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy( + name: &str, + namespace: &str, + optional: ConnectPostServiceProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostServiceProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_post_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostServiceProxyOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PostNamespacedServiceProxyWithPath + +impl Service { + /// connect POST requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_post_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPostServiceProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPostServiceProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_post_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPostServiceProxyWithPathOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path_: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNamespacedServiceProxy + +impl Service { + /// connect PUT requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy( + name: &str, + namespace: &str, + optional: ConnectPutServiceProxyOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutServiceProxyOptional { + path, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path) = path { + __query_pairs.append_pair("path", path); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_put_proxy`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutServiceProxyOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path: Option<&'a str>, +} + +// Generated from operation connectCoreV1PutNamespacedServiceProxyWithPath + +impl Service { + /// connect PUT requests to proxy of Service + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceProxyOptions + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `path` + /// + /// path to the resource + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn connect_put_proxy_with_path( + name: &str, + namespace: &str, + path: &str, + optional: ConnectPutServiceProxyWithPathOptional<'_>, + ) -> Result>, crate::RequestError> { + let ConnectPutServiceProxyWithPathOptional { + path_, + } = optional; + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + path = crate::percent_encoding::percent_encode(path.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + if let Some(path_) = path_ { + __query_pairs.append_pair("path", path_); + } + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = vec![]; + __request.body(__body).map_err(crate::RequestError::Http) + } +} + +/// Optional parameters of [`Service::connect_put_proxy_with_path`] +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default)] +pub struct ConnectPutServiceProxyWithPathOptional<'a> { + /// Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy. + pub path_: Option<&'a str>, +} + +// Generated from operation createCoreV1NamespacedService + +impl Service { + /// create a Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::Service, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedService + +impl Service { + /// delete collection of Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedService + +impl Service { + /// delete a Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedService + +impl Service { + /// list or watch objects of kind Service + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1ServiceForAllNamespaces + +impl Service { + /// list or watch objects of kind Service + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/services?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedService + +impl Service { + /// partially update the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedServiceStatus + +impl Service { + /// partially update status of the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedService + +impl Service { + /// read the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadServiceResponse`]`>` constructor, or [`ReadServiceResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Service::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadServiceResponse { + Ok(crate::api::core::v1::Service), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadServiceResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadServiceResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadServiceResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readCoreV1NamespacedServiceStatus + +impl Service { + /// read status of the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadServiceStatusResponse`]`>` constructor, or [`ReadServiceStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Service::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadServiceStatusResponse { + Ok(crate::api::core::v1::Service), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadServiceStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadServiceStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadServiceStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedService + +impl Service { + /// replace the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Service, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceCoreV1NamespacedServiceStatus + +impl Service { + /// replace status of the specified Service + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Service + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::core::v1::Service, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedService + +impl Service { + /// list or watch objects of kind Service + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/services?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1ServiceForAllNamespaces + +impl Service { + /// list or watch objects of kind Service + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/services?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/Service + +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_25/api/core/v1/service_account.rs b/src/v1_25/api/core/v1/service_account.rs new file mode 100644 index 0000000000..9cc6535f2a --- /dev/null +++ b/src/v1_25/api/core/v1/service_account.rs @@ -0,0 +1,730 @@ +// 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>, +} + +// Begin /v1/ServiceAccount + +// Generated from operation createCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// create a ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::core::v1::ServiceAccount, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1CollectionNamespacedServiceAccount + +impl ServiceAccount { + /// delete collection of ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// delete a ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceAccount + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// list or watch objects of kind ServiceAccount + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listCoreV1ServiceAccountForAllNamespaces + +impl ServiceAccount { + /// list or watch objects of kind ServiceAccount + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/serviceaccounts?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// partially update the specified ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceAccount + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// read the specified ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadServiceAccountResponse`]`>` constructor, or [`ReadServiceAccountResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceAccount + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ServiceAccount::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadServiceAccountResponse { + Ok(crate::api::core::v1::ServiceAccount), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadServiceAccountResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadServiceAccountResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadServiceAccountResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// replace the specified ServiceAccount + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ServiceAccount + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::core::v1::ServiceAccount, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1NamespacedServiceAccount + +impl ServiceAccount { + /// list or watch objects of kind ServiceAccount + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/serviceaccounts?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchCoreV1ServiceAccountForAllNamespaces + +impl ServiceAccount { + /// list or watch objects of kind ServiceAccount + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/api/v1/serviceaccounts?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End /v1/ServiceAccount + +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::DeepMerge::merge_from(&mut self.image_pull_secrets, other.image_pull_secrets); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.secrets, other.secrets); + } +} + +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_25/api/core/v1/service_account_token_projection.rs b/src/v1_25/api/core/v1/service_account_token_projection.rs new file mode 100644 index 0000000000..0e04a0c6fe --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/service_port.rs b/src/v1_25/api/core/v1/service_port.rs new file mode 100644 index 0000000000..cd145923c2 --- /dev/null +++ b/src/v1_25/api/core/v1/service_port.rs @@ -0,0 +1,256 @@ +// 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use 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.\n\n".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_25/api/core/v1/service_spec.rs b/src/v1_25/api/core/v1/service_spec.rs new file mode 100644 index 0000000000..528752c409 --- /dev/null +++ b/src/v1_25/api/core/v1/service_spec.rs @@ -0,0 +1,634 @@ +// 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, and it cannot support dual-stack. As of Kubernetes v1.24, users are encouraged to use implementation-specific annotations when available. This field may be removed in a future API version. + 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, + + /// 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::DeepMerge::merge_from(&mut self.cluster_ips, other.cluster_ips); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.load_balancer_source_ranges, other.load_balancer_source_ranges); + crate::DeepMerge::merge_from(&mut self.ports, other.ports); + crate::DeepMerge::merge_from(&mut self.publish_not_ready_addresses, other.publish_not_ready_addresses); + crate::DeepMerge::merge_from(&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.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_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, + "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_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_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, + 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", + "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.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.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.\n\n".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, and it cannot support dual-stack. As of Kubernetes v1.24, users are encouraged to use implementation-specific annotations when available. This field may be removed in a future API version.".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\n\n".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) + }, + ), + ( + "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\n\n".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_25/api/core/v1/service_status.rs b/src/v1_25/api/core/v1/service_status.rs new file mode 100644 index 0000000000..6c3429fd70 --- /dev/null +++ b/src/v1_25/api/core/v1/service_status.rs @@ -0,0 +1,156 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + 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_25/api/core/v1/session_affinity_config.rs b/src/v1_25/api/core/v1/session_affinity_config.rs new file mode 100644 index 0000000000..0429ae89c7 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/storage_os_persistent_volume_source.rs b/src/v1_25/api/core/v1/storage_os_persistent_volume_source.rs new file mode 100644 index 0000000000..3c2b7aaaee --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/storage_os_volume_source.rs b/src/v1_25/api/core/v1/storage_os_volume_source.rs new file mode 100644 index 0000000000..c5256bc5dc --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/sysctl.rs b/src/v1_25/api/core/v1/sysctl.rs new file mode 100644 index 0000000000..912b473474 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/taint.rs b/src/v1_25/api/core/v1/taint.rs new file mode 100644 index 0000000000..5e7a418d67 --- /dev/null +++ b/src/v1_25/api/core/v1/taint.rs @@ -0,0 +1,202 @@ +// 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.\n\n".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_25/api/core/v1/tcp_socket_action.rs b/src/v1_25/api/core/v1/tcp_socket_action.rs new file mode 100644 index 0000000000..4b987cb82d --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/toleration.rs b/src/v1_25/api/core/v1/toleration.rs new file mode 100644 index 0000000000..9b51a8e3fd --- /dev/null +++ b/src/v1_25/api/core/v1/toleration.rs @@ -0,0 +1,230 @@ +// 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.\n\n".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.\n\n".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_25/api/core/v1/topology_selector_label_requirement.rs b/src/v1_25/api/core/v1/topology_selector_label_requirement.rs new file mode 100644 index 0000000000..3efed6ba65 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/topology_selector_term.rs b/src/v1_25/api/core/v1/topology_selector_term.rs new file mode 100644 index 0000000000..230f7ab530 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/core/v1/topology_spread_constraint.rs b/src/v1_25/api/core/v1/topology_spread_constraint.rs new file mode 100644 index 0000000000..25d8f2d95b --- /dev/null +++ b/src/v1_25/api/core/v1/topology_spread_constraint.rs @@ -0,0 +1,322 @@ +// 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. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + 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. + /// + /// This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). + 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 alpha-level feature 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 alpha-level feature 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::DeepMerge::merge_from(&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. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(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.\n\nThis is a beta field and requires the MinDomainsInPodTopologySpread 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::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 alpha-level feature 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 alpha-level feature 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.\n\n".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_25/api/core/v1/typed_local_object_reference.rs b/src/v1_25/api/core/v1/typed_local_object_reference.rs new file mode 100644 index 0000000000..416e17c468 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/volume.rs b/src/v1_25/api/core/v1/volume.rs new file mode 100644 index 0000000000..dcbc588517 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/volume_device.rs b/src/v1_25/api/core/v1/volume_device.rs new file mode 100644 index 0000000000..60dc3a882b --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/volume_mount.rs b/src/v1_25/api/core/v1/volume_mount.rs new file mode 100644 index 0000000000..1e14c542a7 --- /dev/null +++ b/src/v1_25/api/core/v1/volume_mount.rs @@ -0,0 +1,251 @@ +// 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. + 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, + + /// 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.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_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, + "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_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_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, + sub_path: value_sub_path, + sub_path_expr: value_sub_path_expr, + }) + } + } + + deserializer.deserialize_struct( + "VolumeMount", + &[ + "mountPath", + "mountPropagation", + "name", + "readOnly", + "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.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.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.".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() + }), + ), + ( + "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_25/api/core/v1/volume_node_affinity.rs b/src/v1_25/api/core/v1/volume_node_affinity.rs new file mode 100644 index 0000000000..dedc79a078 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/volume_projection.rs b/src/v1_25/api/core/v1/volume_projection.rs new file mode 100644 index 0000000000..92a488da72 --- /dev/null +++ b/src/v1_25/api/core/v1/volume_projection.rs @@ -0,0 +1,202 @@ +// 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 { + /// 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.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_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 { + "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_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_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 { + config_map: value_config_map, + downward_api: value_downward_api, + secret: value_secret, + service_account_token: value_service_account_token, + }) + } + } + + deserializer.deserialize_struct( + "VolumeProjection", + &[ + "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.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.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: [ + ( + "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_25/api/core/v1/vsphere_virtual_disk_volume_source.rs b/src/v1_25/api/core/v1/vsphere_virtual_disk_volume_source.rs new file mode 100644 index 0000000000..ced7f3da5a --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/weighted_pod_affinity_term.rs b/src/v1_25/api/core/v1/weighted_pod_affinity_term.rs new file mode 100644 index 0000000000..09fca62768 --- /dev/null +++ b/src/v1_25/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_25/api/core/v1/windows_security_context_options.rs b/src/v1_25/api/core/v1/windows_security_context_options.rs new file mode 100644 index 0000000000..332e17d929 --- /dev/null +++ b/src/v1_25/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. This field is alpha-level and will only be honored by components that enable the WindowsHostProcessContainers feature flag. Setting this field without the feature flag will result in errors when validating the Pod. 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. This field is alpha-level and will only be honored by components that enable the WindowsHostProcessContainers feature flag. Setting this field without the feature flag will result in errors when validating the Pod. 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_25/api/discovery/mod.rs b/src/v1_25/api/discovery/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/discovery/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/discovery/v1/endpoint.rs b/src/v1_25/api/discovery/v1/endpoint.rs new file mode 100644 index 0000000000..9878d80d05 --- /dev/null +++ b/src/v1_25/api/discovery/v1/endpoint.rs @@ -0,0 +1,321 @@ +// 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::DeepMerge::merge_from(&mut self.addresses, other.addresses); + crate::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.deprecated_topology, other.deprecated_topology); + 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_25/api/discovery/v1/endpoint_conditions.rs b/src/v1_25/api/discovery/v1/endpoint_conditions.rs new file mode 100644 index 0000000000..c466ca2d98 --- /dev/null +++ b/src/v1_25/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. + 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. This field can be enabled with the EndpointSliceTerminatingCondition feature gate. + 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. This field can be enabled with the EndpointSliceTerminatingCondition feature gate. + 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.".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. This field can be enabled with the EndpointSliceTerminatingCondition feature gate.".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. This field can be enabled with the EndpointSliceTerminatingCondition feature gate.".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_25/api/discovery/v1/endpoint_hints.rs b/src/v1_25/api/discovery/v1/endpoint_hints.rs new file mode 100644 index 0000000000..7fe956528a --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/discovery/v1/endpoint_port.rs b/src/v1_25/api/discovery/v1/endpoint_port.rs new file mode 100644 index 0000000000..af2b03cd5e --- /dev/null +++ b/src/v1_25/api/discovery/v1/endpoint_port.rs @@ -0,0 +1,203 @@ +// 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol. + pub app_protocol: Option, + + /// The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied 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, + + /// 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, + + /// 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 field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use 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. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied 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("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("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_25/api/discovery/v1/endpoint_slice.rs b/src/v1_25/api/discovery/v1/endpoint_slice.rs new file mode 100644 index 0000000000..5858e58711 --- /dev/null +++ b/src/v1_25/api/discovery/v1/endpoint_slice.rs @@ -0,0 +1,727 @@ +// 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>, +} + +// Begin discovery.k8s.io/v1/EndpointSlice + +// Generated from operation createDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// create an EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::discovery::v1::EndpointSlice, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteDiscoveryV1CollectionNamespacedEndpointSlice + +impl EndpointSlice { + /// delete collection of EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// delete an EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the EndpointSlice + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listDiscoveryV1EndpointSliceForAllNamespaces + +impl EndpointSlice { + /// list or watch objects of kind EndpointSlice + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/discovery.k8s.io/v1/endpointslices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// list or watch objects of kind EndpointSlice + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// partially update the specified EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the EndpointSlice + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// read the specified EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadEndpointSliceResponse`]`>` constructor, or [`ReadEndpointSliceResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the EndpointSlice + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`EndpointSlice::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadEndpointSliceResponse { + Ok(crate::api::discovery::v1::EndpointSlice), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadEndpointSliceResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadEndpointSliceResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadEndpointSliceResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// replace the specified EndpointSlice + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the EndpointSlice + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::discovery::v1::EndpointSlice, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchDiscoveryV1EndpointSliceForAllNamespaces + +impl EndpointSlice { + /// list or watch objects of kind EndpointSlice + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/discovery.k8s.io/v1/endpointslices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchDiscoveryV1NamespacedEndpointSlice + +impl EndpointSlice { + /// list or watch objects of kind EndpointSlice + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End discovery.k8s.io/v1/EndpointSlice + +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::DeepMerge::merge_from(&mut self.endpoints, other.endpoints); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&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.\n\n".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_25/api/discovery/v1/for_zone.rs b/src/v1_25/api/discovery/v1/for_zone.rs new file mode 100644 index 0000000000..ab418feb27 --- /dev/null +++ b/src/v1_25/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_25/api/discovery/v1/mod.rs b/src/v1_25/api/discovery/v1/mod.rs new file mode 100644 index 0000000000..4f95e39509 --- /dev/null +++ b/src/v1_25/api/discovery/v1/mod.rs @@ -0,0 +1,19 @@ + +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; +#[cfg(feature = "api")] pub use self::endpoint_slice::ReadEndpointSliceResponse; + +mod for_zone; +pub use self::for_zone::ForZone; diff --git a/src/v1_25/api/events/mod.rs b/src/v1_25/api/events/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/events/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/events/v1/event.rs b/src/v1_25/api/events/v1/event.rs new file mode 100644 index 0000000000..b851702d6d --- /dev/null +++ b/src/v1_25/api/events/v1/event.rs @@ -0,0 +1,996 @@ +// 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, 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: crate::apimachinery::pkg::apis::meta::v1::MicroTime, + + /// 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, +} + +// Begin events.k8s.io/v1/Event + +// Generated from operation createEventsV1NamespacedEvent + +impl Event { + /// create an Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::events::v1::Event, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteEventsV1CollectionNamespacedEvent + +impl Event { + /// delete collection of Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteEventsV1NamespacedEvent + +impl Event { + /// delete an Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listEventsV1EventForAllNamespaces + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/events.k8s.io/v1/events?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listEventsV1NamespacedEvent + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchEventsV1NamespacedEvent + +impl Event { + /// partially update the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readEventsV1NamespacedEvent + +impl Event { + /// read the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadEventResponse`]`>` constructor, or [`ReadEventResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Event::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadEventResponse { + Ok(crate::api::events::v1::Event), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadEventResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadEventResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadEventResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceEventsV1NamespacedEvent + +impl Event { + /// replace the specified Event + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Event + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::events::v1::Event, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchEventsV1EventForAllNamespaces + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/events.k8s.io/v1/events?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchEventsV1NamespacedEvent + +impl Event { + /// list or watch objects of kind Event + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/events.k8s.io/v1/namespaces/{namespace}/events?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End events.k8s.io/v1/Event + +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 = Some(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.ok_or_else(|| crate::serde::de::Error::missing_field("eventTime"))?, + 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, + 4 + + 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.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)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "eventTime", &self.event_time)?; + 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: [ + "eventTime".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/events/v1/event_series.rs b/src/v1_25/api/events/v1/event_series.rs new file mode 100644 index 0000000000..67d23dc643 --- /dev/null +++ b/src/v1_25/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_25/api/events/v1/mod.rs b/src/v1_25/api/events/v1/mod.rs new file mode 100644 index 0000000000..df97b5fd8e --- /dev/null +++ b/src/v1_25/api/events/v1/mod.rs @@ -0,0 +1,7 @@ + +mod event; +pub use self::event::Event; +#[cfg(feature = "api")] pub use self::event::ReadEventResponse; + +mod event_series; +pub use self::event_series::EventSeries; diff --git a/src/v1_25/api/flowcontrol/mod.rs b/src/v1_25/api/flowcontrol/mod.rs new file mode 100644 index 0000000000..3db3c7ee8b --- /dev/null +++ b/src/v1_25/api/flowcontrol/mod.rs @@ -0,0 +1,3 @@ +pub mod v1beta1; + +pub mod v1beta2; diff --git a/src/v1_25/api/flowcontrol/v1beta1/flow_distinguisher_method.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_distinguisher_method.rs new file mode 100644 index 0000000000..511a57f90b --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_distinguisher_method.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_schema.rs new file mode 100644 index 0000000000..1d0546a710 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_schema.rs @@ -0,0 +1,734 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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, +} + +// Begin flowcontrol.apiserver.k8s.io/v1beta1/FlowSchema + +// Generated from operation createFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// create a FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::flowcontrol::v1beta1::FlowSchema, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta1CollectionFlowSchema + +impl FlowSchema { + /// delete collection of FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// delete a FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// list or watch objects of kind FlowSchema + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// partially update the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta1FlowSchemaStatus + +impl FlowSchema { + /// partially update status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// read the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadFlowSchemaResponse`]`>` constructor, or [`ReadFlowSchemaResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`FlowSchema::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadFlowSchemaResponse { + Ok(crate::api::flowcontrol::v1beta1::FlowSchema), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadFlowSchemaResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadFlowSchemaResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadFlowSchemaResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta1FlowSchemaStatus + +impl FlowSchema { + /// read status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadFlowSchemaStatusResponse`]`>` constructor, or [`ReadFlowSchemaStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`FlowSchema::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadFlowSchemaStatusResponse { + Ok(crate::api::flowcontrol::v1beta1::FlowSchema), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadFlowSchemaStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadFlowSchemaStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadFlowSchemaStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// replace the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::flowcontrol::v1beta1::FlowSchema, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta1FlowSchemaStatus + +impl FlowSchema { + /// replace status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::flowcontrol::v1beta1::FlowSchema, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchFlowcontrolApiserverV1beta1FlowSchema + +impl FlowSchema { + /// list or watch objects of kind FlowSchema + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End flowcontrol.apiserver.k8s.io/v1beta1/FlowSchema + +impl crate::Resource for FlowSchema { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta1"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "FlowSchema"; + const VERSION: &'static str = "v1beta1"; + 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.v1beta1.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_25/api/flowcontrol/v1beta1/flow_schema_condition.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_condition.rs new file mode 100644 index 0000000000..b30da2945c --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/flow_schema_spec.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_spec.rs new file mode 100644 index 0000000000..40031e5acc --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_spec.rs @@ -0,0 +1,208 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::v1beta1::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::DeepMerge::merge_from(&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.v1beta1.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_25/api/flowcontrol/v1beta1/flow_schema_status.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_status.rs new file mode 100644 index 0000000000..c463e68e6a --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_schema_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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.v1beta1.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_25/api/flowcontrol/v1beta1/group_subject.rs b/src/v1_25/api/flowcontrol/v1beta1/group_subject.rs new file mode 100644 index 0000000000..5e5e6740b3 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/group_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/limit_response.rs b/src/v1_25/api/flowcontrol/v1beta1/limit_response.rs new file mode 100644 index 0000000000..1ecedfb99d --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/limit_response.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/limited_priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta1/limited_priority_level_configuration.rs new file mode 100644 index 0000000000..43a53a4de5 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/limited_priority_level_configuration.rs @@ -0,0 +1,159 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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 { + /// `assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level: + /// + /// ACV(l) = ceil( SCL * ACS(l) / ( sum\[priority levels k\] ACS(k) ) ) + /// + /// bigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30. + pub assured_concurrency_shares: Option, + + /// `limitResponse` indicates what to do with requests that can not be executed right now + pub limit_response: Option, +} + +impl crate::DeepMerge for LimitedPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.assured_concurrency_shares, other.assured_concurrency_shares); + crate::DeepMerge::merge_from(&mut self.limit_response, other.limit_response); + } +} + +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_assured_concurrency_shares, + Key_limit_response, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "assuredConcurrencyShares" => Field::Key_assured_concurrency_shares, + "limitResponse" => Field::Key_limit_response, + _ => 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_assured_concurrency_shares: Option = None; + let mut value_limit_response: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_assured_concurrency_shares => value_assured_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limit_response => value_limit_response = 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 { + assured_concurrency_shares: value_assured_concurrency_shares, + limit_response: value_limit_response, + }) + } + } + + deserializer.deserialize_struct( + "LimitedPriorityLevelConfiguration", + &[ + "assuredConcurrencyShares", + "limitResponse", + ], + 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.assured_concurrency_shares.as_ref().map_or(0, |_| 1) + + self.limit_response.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.assured_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "assuredConcurrencyShares", value)?; + } + if let Some(value) = &self.limit_response { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limitResponse", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitedPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta1.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: [ + ( + "assuredConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level:\n\n ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )\n\nbigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). 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() + }), + ), + ( + "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) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/flowcontrol/v1beta1/mod.rs b/src/v1_25/api/flowcontrol/v1beta1/mod.rs new file mode 100644 index 0000000000..2c08d5bd64 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/mod.rs @@ -0,0 +1,64 @@ + +mod flow_distinguisher_method; +pub use self::flow_distinguisher_method::FlowDistinguisherMethod; + +mod flow_schema; +pub use self::flow_schema::FlowSchema; +#[cfg(feature = "api")] pub use self::flow_schema::ReadFlowSchemaResponse; +#[cfg(feature = "api")] pub use self::flow_schema::ReadFlowSchemaStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::priority_level_configuration::ReadPriorityLevelConfigurationResponse; +#[cfg(feature = "api")] pub use self::priority_level_configuration::ReadPriorityLevelConfigurationStatusResponse; + +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_25/api/flowcontrol/v1beta1/non_resource_policy_rule.rs b/src/v1_25/api/flowcontrol/v1beta1/non_resource_policy_rule.rs new file mode 100644 index 0000000000..80b8803dc1 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/non_resource_policy_rule.rs @@ -0,0 +1,175 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::DeepMerge::merge_from(&mut self.non_resource_urls, other.non_resource_urls); + crate::DeepMerge::merge_from(&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.v1beta1.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_25/api/flowcontrol/v1beta1/policy_rules_with_subjects.rs b/src/v1_25/api/flowcontrol/v1beta1/policy_rules_with_subjects.rs new file mode 100644 index 0000000000..780a347761 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/policy_rules_with_subjects.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::DeepMerge::merge_from(&mut self.non_resource_rules, other.non_resource_rules); + crate::DeepMerge::merge_from(&mut self.resource_rules, other.resource_rules); + crate::DeepMerge::merge_from(&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.v1beta1.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_25/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs new file mode 100644 index 0000000000..4cbe999e32 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -0,0 +1,734 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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, +} + +// Begin flowcontrol.apiserver.k8s.io/v1beta1/PriorityLevelConfiguration + +// Generated from operation createFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// create a PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::flowcontrol::v1beta1::PriorityLevelConfiguration, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta1CollectionPriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// delete collection of PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// delete a PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// list or watch objects of kind PriorityLevelConfiguration + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// partially update the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta1PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// partially update status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// read the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPriorityLevelConfigurationResponse`]`>` constructor, or [`ReadPriorityLevelConfigurationResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PriorityLevelConfiguration::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPriorityLevelConfigurationResponse { + Ok(crate::api::flowcontrol::v1beta1::PriorityLevelConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPriorityLevelConfigurationResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPriorityLevelConfigurationResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPriorityLevelConfigurationResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta1PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// read status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPriorityLevelConfigurationStatusResponse`]`>` constructor, or [`ReadPriorityLevelConfigurationStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PriorityLevelConfiguration::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPriorityLevelConfigurationStatusResponse { + Ok(crate::api::flowcontrol::v1beta1::PriorityLevelConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPriorityLevelConfigurationStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPriorityLevelConfigurationStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPriorityLevelConfigurationStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// replace the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::flowcontrol::v1beta1::PriorityLevelConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta1PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// replace status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::flowcontrol::v1beta1::PriorityLevelConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchFlowcontrolApiserverV1beta1PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// list or watch objects of kind PriorityLevelConfiguration + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End flowcontrol.apiserver.k8s.io/v1beta1/PriorityLevelConfiguration + +impl crate::Resource for PriorityLevelConfiguration { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta1"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "PriorityLevelConfiguration"; + const VERSION: &'static str = "v1beta1"; + 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.v1beta1.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_25/api/flowcontrol/v1beta1/priority_level_configuration_condition.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_condition.rs new file mode 100644 index 0000000000..cfb9a1c0d3 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/priority_level_configuration_reference.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_reference.rs new file mode 100644 index 0000000000..cf5e9a5456 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_reference.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/priority_level_configuration_spec.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_spec.rs new file mode 100644 index 0000000000..05e72b2d35 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_spec.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfigurationSpec + +/// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationSpec { + /// `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.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_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 { + "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_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_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 { + limited: value_limited, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationSpec", + &[ + "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.limited.as_ref().map_or(0, |_| 1), + )?; + 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.v1beta1.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: [ + ( + "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_25/api/flowcontrol/v1beta1/priority_level_configuration_status.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_status.rs new file mode 100644 index 0000000000..a356b4a6df --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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.v1beta1.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_25/api/flowcontrol/v1beta1/queuing_configuration.rs b/src/v1_25/api/flowcontrol/v1beta1/queuing_configuration.rs new file mode 100644 index 0000000000..9be5aac269 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/queuing_configuration.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/resource_policy_rule.rs b/src/v1_25/api/flowcontrol/v1beta1/resource_policy_rule.rs new file mode 100644 index 0000000000..93d3b933e4 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/resource_policy_rule.rs @@ -0,0 +1,260 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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::DeepMerge::merge_from(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.cluster_scope, other.cluster_scope); + crate::DeepMerge::merge_from(&mut self.namespaces, other.namespaces); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&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.v1beta1.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_25/api/flowcontrol/v1beta1/service_account_subject.rs b/src/v1_25/api/flowcontrol/v1beta1/service_account_subject.rs new file mode 100644 index 0000000000..712e465c42 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/service_account_subject.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/subject.rs b/src/v1_25/api/flowcontrol/v1beta1/subject.rs new file mode 100644 index 0000000000..010c7ec43c --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/subject.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta1/user_subject.rs b/src/v1_25/api/flowcontrol/v1beta1/user_subject.rs new file mode 100644 index 0000000000..cfb7703025 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta1/user_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta1.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.v1beta1.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_25/api/flowcontrol/v1beta2/flow_distinguisher_method.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_distinguisher_method.rs new file mode 100644 index 0000000000..b80c64c4e6 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_distinguisher_method.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs new file mode 100644 index 0000000000..71d13230a3 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs @@ -0,0 +1,734 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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, +} + +// Begin flowcontrol.apiserver.k8s.io/v1beta2/FlowSchema + +// Generated from operation createFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// create a FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::flowcontrol::v1beta2::FlowSchema, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta2CollectionFlowSchema + +impl FlowSchema { + /// delete collection of FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// delete a FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// list or watch objects of kind FlowSchema + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// partially update the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta2FlowSchemaStatus + +impl FlowSchema { + /// partially update status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// read the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadFlowSchemaResponse`]`>` constructor, or [`ReadFlowSchemaResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`FlowSchema::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadFlowSchemaResponse { + Ok(crate::api::flowcontrol::v1beta2::FlowSchema), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadFlowSchemaResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadFlowSchemaResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadFlowSchemaResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta2FlowSchemaStatus + +impl FlowSchema { + /// read status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadFlowSchemaStatusResponse`]`>` constructor, or [`ReadFlowSchemaStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`FlowSchema::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadFlowSchemaStatusResponse { + Ok(crate::api::flowcontrol::v1beta2::FlowSchema), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadFlowSchemaStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadFlowSchemaStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadFlowSchemaStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// replace the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::flowcontrol::v1beta2::FlowSchema, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta2FlowSchemaStatus + +impl FlowSchema { + /// replace status of the specified FlowSchema + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the FlowSchema + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::flowcontrol::v1beta2::FlowSchema, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchFlowcontrolApiserverV1beta2FlowSchema + +impl FlowSchema { + /// list or watch objects of kind FlowSchema + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/flowschemas?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End flowcontrol.apiserver.k8s.io/v1beta2/FlowSchema + +impl crate::Resource for FlowSchema { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta2"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "FlowSchema"; + const VERSION: &'static str = "v1beta2"; + 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.v1beta2.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_25/api/flowcontrol/v1beta2/flow_schema_condition.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_condition.rs new file mode 100644 index 0000000000..b2c25d47ec --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/flow_schema_spec.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_spec.rs new file mode 100644 index 0000000000..e28a19711f --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_spec.rs @@ -0,0 +1,208 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::v1beta2::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::DeepMerge::merge_from(&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.v1beta2.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_25/api/flowcontrol/v1beta2/flow_schema_status.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_status.rs new file mode 100644 index 0000000000..104835c519 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_schema_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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.v1beta2.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_25/api/flowcontrol/v1beta2/group_subject.rs b/src/v1_25/api/flowcontrol/v1beta2/group_subject.rs new file mode 100644 index 0000000000..dfe20c42ca --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/group_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/limit_response.rs b/src/v1_25/api/flowcontrol/v1beta2/limit_response.rs new file mode 100644 index 0000000000..30922d6fbb --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/limit_response.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/limited_priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta2/limited_priority_level_configuration.rs new file mode 100644 index 0000000000..54a88f52df --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/limited_priority_level_configuration.rs @@ -0,0 +1,159 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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 { + /// `assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level: + /// + /// ACV(l) = ceil( SCL * ACS(l) / ( sum\[priority levels k\] ACS(k) ) ) + /// + /// bigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30. + pub assured_concurrency_shares: Option, + + /// `limitResponse` indicates what to do with requests that can not be executed right now + pub limit_response: Option, +} + +impl crate::DeepMerge for LimitedPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.assured_concurrency_shares, other.assured_concurrency_shares); + crate::DeepMerge::merge_from(&mut self.limit_response, other.limit_response); + } +} + +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_assured_concurrency_shares, + Key_limit_response, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "assuredConcurrencyShares" => Field::Key_assured_concurrency_shares, + "limitResponse" => Field::Key_limit_response, + _ => 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_assured_concurrency_shares: Option = None; + let mut value_limit_response: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_assured_concurrency_shares => value_assured_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limit_response => value_limit_response = 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 { + assured_concurrency_shares: value_assured_concurrency_shares, + limit_response: value_limit_response, + }) + } + } + + deserializer.deserialize_struct( + "LimitedPriorityLevelConfiguration", + &[ + "assuredConcurrencyShares", + "limitResponse", + ], + 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.assured_concurrency_shares.as_ref().map_or(0, |_| 1) + + self.limit_response.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.assured_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "assuredConcurrencyShares", value)?; + } + if let Some(value) = &self.limit_response { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limitResponse", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitedPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta2.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: [ + ( + "assuredConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level:\n\n ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )\n\nbigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). 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() + }), + ), + ( + "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) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/flowcontrol/v1beta2/mod.rs b/src/v1_25/api/flowcontrol/v1beta2/mod.rs new file mode 100644 index 0000000000..2c08d5bd64 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/mod.rs @@ -0,0 +1,64 @@ + +mod flow_distinguisher_method; +pub use self::flow_distinguisher_method::FlowDistinguisherMethod; + +mod flow_schema; +pub use self::flow_schema::FlowSchema; +#[cfg(feature = "api")] pub use self::flow_schema::ReadFlowSchemaResponse; +#[cfg(feature = "api")] pub use self::flow_schema::ReadFlowSchemaStatusResponse; + +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; +#[cfg(feature = "api")] pub use self::priority_level_configuration::ReadPriorityLevelConfigurationResponse; +#[cfg(feature = "api")] pub use self::priority_level_configuration::ReadPriorityLevelConfigurationStatusResponse; + +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_25/api/flowcontrol/v1beta2/non_resource_policy_rule.rs b/src/v1_25/api/flowcontrol/v1beta2/non_resource_policy_rule.rs new file mode 100644 index 0000000000..e9be9c98a4 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/non_resource_policy_rule.rs @@ -0,0 +1,175 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::DeepMerge::merge_from(&mut self.non_resource_urls, other.non_resource_urls); + crate::DeepMerge::merge_from(&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.v1beta2.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_25/api/flowcontrol/v1beta2/policy_rules_with_subjects.rs b/src/v1_25/api/flowcontrol/v1beta2/policy_rules_with_subjects.rs new file mode 100644 index 0000000000..55c59b24a2 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/policy_rules_with_subjects.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::DeepMerge::merge_from(&mut self.non_resource_rules, other.non_resource_rules); + crate::DeepMerge::merge_from(&mut self.resource_rules, other.resource_rules); + crate::DeepMerge::merge_from(&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.v1beta2.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_25/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs new file mode 100644 index 0000000000..91ebc9f1f5 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -0,0 +1,734 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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, +} + +// Begin flowcontrol.apiserver.k8s.io/v1beta2/PriorityLevelConfiguration + +// Generated from operation createFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// create a PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::flowcontrol::v1beta2::PriorityLevelConfiguration, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta2CollectionPriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// delete collection of PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// delete a PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// list or watch objects of kind PriorityLevelConfiguration + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// partially update the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchFlowcontrolApiserverV1beta2PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// partially update status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// read the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPriorityLevelConfigurationResponse`]`>` constructor, or [`ReadPriorityLevelConfigurationResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PriorityLevelConfiguration::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPriorityLevelConfigurationResponse { + Ok(crate::api::flowcontrol::v1beta2::PriorityLevelConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPriorityLevelConfigurationResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPriorityLevelConfigurationResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPriorityLevelConfigurationResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readFlowcontrolApiserverV1beta2PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// read status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPriorityLevelConfigurationStatusResponse`]`>` constructor, or [`ReadPriorityLevelConfigurationStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PriorityLevelConfiguration::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPriorityLevelConfigurationStatusResponse { + Ok(crate::api::flowcontrol::v1beta2::PriorityLevelConfiguration), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPriorityLevelConfigurationStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPriorityLevelConfigurationStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPriorityLevelConfigurationStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// replace the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::flowcontrol::v1beta2::PriorityLevelConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceFlowcontrolApiserverV1beta2PriorityLevelConfigurationStatus + +impl PriorityLevelConfiguration { + /// replace status of the specified PriorityLevelConfiguration + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityLevelConfiguration + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::flowcontrol::v1beta2::PriorityLevelConfiguration, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchFlowcontrolApiserverV1beta2PriorityLevelConfiguration + +impl PriorityLevelConfiguration { + /// list or watch objects of kind PriorityLevelConfiguration + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/prioritylevelconfigurations?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End flowcontrol.apiserver.k8s.io/v1beta2/PriorityLevelConfiguration + +impl crate::Resource for PriorityLevelConfiguration { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta2"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "PriorityLevelConfiguration"; + const VERSION: &'static str = "v1beta2"; + 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.v1beta2.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_25/api/flowcontrol/v1beta2/priority_level_configuration_condition.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_condition.rs new file mode 100644 index 0000000000..b032f2fa69 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/priority_level_configuration_reference.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_reference.rs new file mode 100644 index 0000000000..41de03277c --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_reference.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/priority_level_configuration_spec.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_spec.rs new file mode 100644 index 0000000000..8f0850dc6d --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_spec.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfigurationSpec + +/// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationSpec { + /// `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.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_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 { + "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_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_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 { + limited: value_limited, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationSpec", + &[ + "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.limited.as_ref().map_or(0, |_| 1), + )?; + 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.v1beta2.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: [ + ( + "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_25/api/flowcontrol/v1beta2/priority_level_configuration_status.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_status.rs new file mode 100644 index 0000000000..3a1f5c9216 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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.v1beta2.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_25/api/flowcontrol/v1beta2/queuing_configuration.rs b/src/v1_25/api/flowcontrol/v1beta2/queuing_configuration.rs new file mode 100644 index 0000000000..663fb12370 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/queuing_configuration.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/resource_policy_rule.rs b/src/v1_25/api/flowcontrol/v1beta2/resource_policy_rule.rs new file mode 100644 index 0000000000..f4db7b13a2 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/resource_policy_rule.rs @@ -0,0 +1,260 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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::DeepMerge::merge_from(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.cluster_scope, other.cluster_scope); + crate::DeepMerge::merge_from(&mut self.namespaces, other.namespaces); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&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.v1beta2.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_25/api/flowcontrol/v1beta2/service_account_subject.rs b/src/v1_25/api/flowcontrol/v1beta2/service_account_subject.rs new file mode 100644 index 0000000000..9e4e7b7166 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/service_account_subject.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/subject.rs b/src/v1_25/api/flowcontrol/v1beta2/subject.rs new file mode 100644 index 0000000000..0070a46aeb --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/subject.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/flowcontrol/v1beta2/user_subject.rs b/src/v1_25/api/flowcontrol/v1beta2/user_subject.rs new file mode 100644 index 0000000000..3c56edb153 --- /dev/null +++ b/src/v1_25/api/flowcontrol/v1beta2/user_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta2.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.v1beta2.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_25/api/mod.rs b/src/v1_25/api/mod.rs new file mode 100644 index 0000000000..992ff58359 --- /dev/null +++ b/src/v1_25/api/mod.rs @@ -0,0 +1,37 @@ +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 scheduling; + +pub mod storage; diff --git a/src/v1_25/api/networking/mod.rs b/src/v1_25/api/networking/mod.rs new file mode 100644 index 0000000000..eddcfcf9eb --- /dev/null +++ b/src/v1_25/api/networking/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1alpha1; diff --git a/src/v1_25/api/networking/v1/http_ingress_path.rs b/src/v1_25/api/networking/v1/http_ingress_path.rs new file mode 100644 index 0000000000..512fb6d8a4 --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/http_ingress_rule_value.rs b/src/v1_25/api/networking/v1/http_ingress_rule_value.rs new file mode 100644 index 0000000000..acc836c728 --- /dev/null +++ b/src/v1_25/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 { + /// 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::DeepMerge::merge_from(&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("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_25/api/networking/v1/ingress.rs b/src/v1_25/api/networking/v1/ingress.rs new file mode 100644 index 0000000000..c9e616121f --- /dev/null +++ b/src/v1_25/api/networking/v1/ingress.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin networking.k8s.io/v1/Ingress + +// Generated from operation createNetworkingV1NamespacedIngress + +impl Ingress { + /// create an Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::networking::v1::Ingress, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1CollectionNamespacedIngress + +impl Ingress { + /// delete collection of Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1NamespacedIngress + +impl Ingress { + /// delete an Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1IngressForAllNamespaces + +impl Ingress { + /// list or watch objects of kind Ingress + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingresses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1NamespacedIngress + +impl Ingress { + /// list or watch objects of kind Ingress + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1NamespacedIngress + +impl Ingress { + /// partially update the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1NamespacedIngressStatus + +impl Ingress { + /// partially update status of the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readNetworkingV1NamespacedIngress + +impl Ingress { + /// read the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadIngressResponse`]`>` constructor, or [`ReadIngressResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Ingress::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadIngressResponse { + Ok(crate::api::networking::v1::Ingress), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadIngressResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadIngressResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadIngressResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readNetworkingV1NamespacedIngressStatus + +impl Ingress { + /// read status of the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadIngressStatusResponse`]`>` constructor, or [`ReadIngressStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Ingress::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadIngressStatusResponse { + Ok(crate::api::networking::v1::Ingress), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadIngressStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadIngressStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadIngressStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceNetworkingV1NamespacedIngress + +impl Ingress { + /// replace the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::networking::v1::Ingress, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceNetworkingV1NamespacedIngressStatus + +impl Ingress { + /// replace status of the specified Ingress + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Ingress + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::networking::v1::Ingress, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1IngressForAllNamespaces + +impl Ingress { + /// list or watch objects of kind Ingress + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingresses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1NamespacedIngress + +impl Ingress { + /// list or watch objects of kind Ingress + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End networking.k8s.io/v1/Ingress + +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_25/api/networking/v1/ingress_backend.rs b/src/v1_25/api/networking/v1/ingress_backend.rs new file mode 100644 index 0000000000..00499eef5f --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_class.rs b/src/v1_25/api/networking/v1/ingress_class.rs new file mode 100644 index 0000000000..d3ab7820c7 --- /dev/null +++ b/src/v1_25/api/networking/v1/ingress_class.rs @@ -0,0 +1,556 @@ +// 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, +} + +// Begin networking.k8s.io/v1/IngressClass + +// Generated from operation createNetworkingV1IngressClass + +impl IngressClass { + /// create an IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::networking::v1::IngressClass, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingressclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1CollectionIngressClass + +impl IngressClass { + /// delete collection of IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingressclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1IngressClass + +impl IngressClass { + /// delete an IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the IngressClass + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/ingressclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1IngressClass + +impl IngressClass { + /// list or watch objects of kind IngressClass + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingressclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1IngressClass + +impl IngressClass { + /// partially update the specified IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the IngressClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/ingressclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readNetworkingV1IngressClass + +impl IngressClass { + /// read the specified IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadIngressClassResponse`]`>` constructor, or [`ReadIngressClassResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the IngressClass + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/ingressclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`IngressClass::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadIngressClassResponse { + Ok(crate::api::networking::v1::IngressClass), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadIngressClassResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadIngressClassResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadIngressClassResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceNetworkingV1IngressClass + +impl IngressClass { + /// replace the specified IngressClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the IngressClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::networking::v1::IngressClass, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/ingressclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1IngressClass + +impl IngressClass { + /// list or watch objects of kind IngressClass + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/ingressclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End networking.k8s.io/v1/IngressClass + +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_25/api/networking/v1/ingress_class_parameters_reference.rs b/src/v1_25/api/networking/v1/ingress_class_parameters_reference.rs new file mode 100644 index 0000000000..6c28bb29d2 --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_class_spec.rs b/src/v1_25/api/networking/v1/ingress_class_spec.rs new file mode 100644 index 0000000000..59ca335b98 --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_rule.rs b/src/v1_25/api/networking/v1/ingress_rule.rs new file mode 100644 index 0000000000..3c629fc19f --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_service_backend.rs b/src/v1_25/api/networking/v1/ingress_service_backend.rs new file mode 100644 index 0000000000..bb7d4ef794 --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_spec.rs b/src/v1_25/api/networking/v1/ingress_spec.rs new file mode 100644 index 0000000000..a4020c43b9 --- /dev/null +++ b/src/v1_25/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, + + /// 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 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::DeepMerge::merge_from(&mut self.rules, other.rules); + crate::DeepMerge::merge_from(&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("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 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_25/api/networking/v1/ingress_status.rs b/src/v1_25/api/networking/v1/ingress_status.rs new file mode 100644 index 0000000000..37c5406293 --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1/ingress_tls.rs b/src/v1_25/api/networking/v1/ingress_tls.rs new file mode 100644 index 0000000000..d48a83a0c4 --- /dev/null +++ b/src/v1_25/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 are 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::DeepMerge::merge_from(&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 are 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_25/api/networking/v1/ip_block.rs b/src/v1_25/api/networking/v1/ip_block.rs new file mode 100644 index 0000000000..46458b01c5 --- /dev/null +++ b/src/v1_25/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.1/24","2001:db9::/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 IP Block Valid examples are "192.168.1.1/24" or "2001:db9::/64" + pub cidr: String, + + /// Except is a slice of CIDRs that should not be included within an IP Block Valid examples are "192.168.1.1/24" or "2001:db9::/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::DeepMerge::merge_from(&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.1/24\",\"2001:db9::/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 IP Block Valid examples are \"192.168.1.1/24\" or \"2001:db9::/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 IP Block Valid examples are \"192.168.1.1/24\" or \"2001:db9::/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_25/api/networking/v1/mod.rs b/src/v1_25/api/networking/v1/mod.rs new file mode 100644 index 0000000000..c8622860c4 --- /dev/null +++ b/src/v1_25/api/networking/v1/mod.rs @@ -0,0 +1,68 @@ + +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; +#[cfg(feature = "api")] pub use self::ingress::ReadIngressResponse; +#[cfg(feature = "api")] pub use self::ingress::ReadIngressStatusResponse; + +mod ingress_backend; +pub use self::ingress_backend::IngressBackend; + +mod ingress_class; +pub use self::ingress_class::IngressClass; +#[cfg(feature = "api")] pub use self::ingress_class::ReadIngressClassResponse; + +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_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; +#[cfg(feature = "api")] pub use self::network_policy::ReadNetworkPolicyResponse; +#[cfg(feature = "api")] pub use self::network_policy::ReadNetworkPolicyStatusResponse; + +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 network_policy_status; +pub use self::network_policy_status::NetworkPolicyStatus; + +mod service_backend_port; +pub use self::service_backend_port::ServiceBackendPort; diff --git a/src/v1_25/api/networking/v1/network_policy.rs b/src/v1_25/api/networking/v1/network_policy.rs new file mode 100644 index 0000000000..36ed661520 --- /dev/null +++ b/src/v1_25/api/networking/v1/network_policy.rs @@ -0,0 +1,868 @@ +// 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, + + /// Specification of the desired behavior for this NetworkPolicy. + pub spec: Option, + + /// Status is the current state of the NetworkPolicy. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +// Begin networking.k8s.io/v1/NetworkPolicy + +// Generated from operation createNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// create a NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::networking::v1::NetworkPolicy, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1CollectionNamespacedNetworkPolicy + +impl NetworkPolicy { + /// delete collection of NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// delete a NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// list or watch objects of kind NetworkPolicy + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1NetworkPolicyForAllNamespaces + +impl NetworkPolicy { + /// list or watch objects of kind NetworkPolicy + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/networkpolicies?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// partially update the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1NamespacedNetworkPolicyStatus + +impl NetworkPolicy { + /// partially update status of the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// read the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNetworkPolicyResponse`]`>` constructor, or [`ReadNetworkPolicyResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`NetworkPolicy::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNetworkPolicyResponse { + Ok(crate::api::networking::v1::NetworkPolicy), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNetworkPolicyResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNetworkPolicyResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNetworkPolicyResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readNetworkingV1NamespacedNetworkPolicyStatus + +impl NetworkPolicy { + /// read status of the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadNetworkPolicyStatusResponse`]`>` constructor, or [`ReadNetworkPolicyStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`NetworkPolicy::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadNetworkPolicyStatusResponse { + Ok(crate::api::networking::v1::NetworkPolicy), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadNetworkPolicyStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadNetworkPolicyStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadNetworkPolicyStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// replace the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::networking::v1::NetworkPolicy, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceNetworkingV1NamespacedNetworkPolicyStatus + +impl NetworkPolicy { + /// replace status of the specified NetworkPolicy + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the NetworkPolicy + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::networking::v1::NetworkPolicy, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1NamespacedNetworkPolicy + +impl NetworkPolicy { + /// list or watch objects of kind NetworkPolicy + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1NetworkPolicyForAllNamespaces + +impl NetworkPolicy { + /// list or watch objects of kind NetworkPolicy + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/networkpolicies?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End networking.k8s.io/v1/NetworkPolicy + +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); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +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, + 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 = 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; + 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(NetworkPolicy { + 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 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) + + 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 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("Specification of the desired behavior for this NetworkPolicy.".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 NetworkPolicy. 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_25/api/networking/v1/network_policy_egress_rule.rs b/src/v1_25/api/networking/v1/network_policy_egress_rule.rs new file mode 100644 index 0000000000..33619be210 --- /dev/null +++ b/src/v1_25/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 { + /// 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>, + + /// 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::DeepMerge::merge_from(&mut self.ports, other.ports); + crate::DeepMerge::merge_from(&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("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("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_25/api/networking/v1/network_policy_ingress_rule.rs b/src/v1_25/api/networking/v1/network_policy_ingress_rule.rs new file mode 100644 index 0000000000..2c68ec44a7 --- /dev/null +++ b/src/v1_25/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 { + /// 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>, + + /// 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::DeepMerge::merge_from(&mut self.from, other.from); + crate::DeepMerge::merge_from(&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("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("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_25/api/networking/v1/network_policy_peer.rs b/src/v1_25/api/networking/v1/network_policy_peer.rs new file mode 100644 index 0000000000..354c8bcae3 --- /dev/null +++ b/src/v1_25/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, + + /// 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, + + /// This 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("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("This 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_25/api/networking/v1/network_policy_port.rs b/src/v1_25/api/networking/v1/network_policy_port.rs new file mode 100644 index 0000000000..f8d8ae15b2 --- /dev/null +++ b/src/v1_25/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 { + /// If set, indicates that the range of ports from port to endPort, 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, + + /// 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, + + /// 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("If set, indicates that the range of ports from port to endPort, 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("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("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_25/api/networking/v1/network_policy_spec.rs b/src/v1_25/api/networking/v1/network_policy_spec.rs new file mode 100644 index 0000000000..ed61b60968 --- /dev/null +++ b/src/v1_25/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 { + /// 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>, + + /// 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>, + + /// 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, + + /// 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::DeepMerge::merge_from(&mut self.egress, other.egress); + crate::DeepMerge::merge_from(&mut self.ingress, other.ingress); + crate::DeepMerge::merge_from(&mut self.pod_selector, other.pod_selector); + crate::DeepMerge::merge_from(&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("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("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("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("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_25/api/networking/v1/network_policy_status.rs b/src/v1_25/api/networking/v1/network_policy_status.rs new file mode 100644 index 0000000000..379f560ac3 --- /dev/null +++ b/src/v1_25/api/networking/v1/network_policy_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicyStatus + +/// NetworkPolicyStatus describe the current state of the NetworkPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicyStatus { + /// Conditions holds an array of metav1.Condition that describe the state of the NetworkPolicy. Current service state + pub conditions: Option>, +} + +impl crate::DeepMerge for NetworkPolicyStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicyStatus { + 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 = NetworkPolicyStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicyStatus") + } + + 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(NetworkPolicyStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicyStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicyStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicyStatus", + 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 NetworkPolicyStatus { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicyStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicyStatus describe the current state of the 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: [ + ( + "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 NetworkPolicy. 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_25/api/networking/v1/service_backend_port.rs b/src/v1_25/api/networking/v1/service_backend_port.rs new file mode 100644 index 0000000000..3dee9d8b7a --- /dev/null +++ b/src/v1_25/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_25/api/networking/v1alpha1/cluster_cidr.rs b/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs new file mode 100644 index 0000000000..bead0f8dcf --- /dev/null +++ b/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs @@ -0,0 +1,556 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ClusterCIDR + +/// ClusterCIDR represents a single configuration for per-Node Pod CIDR allocations when the MultiCIDRRangeAllocator is enabled (see the config for kube-controller-manager). A cluster may have any number of ClusterCIDR resources, all of which will be considered when allocating a CIDR for a Node. A ClusterCIDR is eligible to be used for a given Node when the node selector matches the node in question and has free CIDRs to allocate. In case of multiple matching ClusterCIDR resources, the allocator will attempt to break ties using internal heuristics, but any ClusterCIDR whose node selector matches the Node may be used. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterCIDR { + /// 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 ClusterCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +// Begin networking.k8s.io/v1alpha1/ClusterCIDR + +// Generated from operation createNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// create a ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::networking::v1alpha1::ClusterCIDR, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1alpha1/clustercidrs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// delete a ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterCIDR + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1alpha1/clustercidrs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNetworkingV1alpha1CollectionClusterCIDR + +impl ClusterCIDR { + /// delete collection of ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1alpha1/clustercidrs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// list or watch objects of kind ClusterCIDR + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1alpha1/clustercidrs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// partially update the specified ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterCIDR + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1alpha1/clustercidrs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// read the specified ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadClusterCIDRResponse`]`>` constructor, or [`ReadClusterCIDRResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterCIDR + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1alpha1/clustercidrs/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ClusterCIDR::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadClusterCIDRResponse { + Ok(crate::api::networking::v1alpha1::ClusterCIDR), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadClusterCIDRResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadClusterCIDRResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadClusterCIDRResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// replace the specified ClusterCIDR + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterCIDR + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::networking::v1alpha1::ClusterCIDR, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/networking.k8s.io/v1alpha1/clustercidrs/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNetworkingV1alpha1ClusterCIDR + +impl ClusterCIDR { + /// list or watch objects of kind ClusterCIDR + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1alpha1/clustercidrs?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End networking.k8s.io/v1alpha1/ClusterCIDR + +impl crate::Resource for ClusterCIDR { + const API_VERSION: &'static str = "networking.k8s.io/v1alpha1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "ClusterCIDR"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "clustercidrs"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ClusterCIDR { + const LIST_KIND: &'static str = "ClusterCIDRList"; +} + +impl crate::Metadata for ClusterCIDR { + 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 ClusterCIDR { + 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 ClusterCIDR { + 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 = ClusterCIDR; + + 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(ClusterCIDR { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterCIDR { + 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 ClusterCIDR { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ClusterCIDR".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterCIDR represents a single configuration for per-Node Pod CIDR allocations when the MultiCIDRRangeAllocator is enabled (see the config for kube-controller-manager). A cluster may have any number of ClusterCIDR resources, all of which will be considered when allocating a CIDR for a Node. A ClusterCIDR is eligible to be used for a given Node when the node selector matches the node in question and has free CIDRs to allocate. In case of multiple matching ClusterCIDR resources, the allocator will attempt to break ties using internal heuristics, but any ClusterCIDR whose node selector matches the Node may be 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: [ + ( + "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 ClusterCIDR. 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_25/api/networking/v1alpha1/cluster_cidr_spec.rs b/src/v1_25/api/networking/v1alpha1/cluster_cidr_spec.rs new file mode 100644 index 0000000000..33ef91f579 --- /dev/null +++ b/src/v1_25/api/networking/v1alpha1/cluster_cidr_spec.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ClusterCIDRSpec + +/// ClusterCIDRSpec defines the desired state of ClusterCIDR. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterCIDRSpec { + /// IPv4 defines an IPv4 IP block in CIDR notation(e.g. "10.0.0.0/8"). At least one of IPv4 and IPv6 must be specified. This field is immutable. + pub ipv4: Option, + + /// IPv6 defines an IPv6 IP block in CIDR notation(e.g. "fd12:3456:789a:1::/64"). At least one of IPv4 and IPv6 must be specified. This field is immutable. + pub ipv6: Option, + + /// NodeSelector defines which nodes the config is applicable to. An empty or nil NodeSelector selects all nodes. This field is immutable. + pub node_selector: Option, + + /// PerNodeHostBits defines the number of host bits to be configured per node. A subnet mask determines how much of the address is used for network bits and host bits. For example an IPv4 address of 192.168.0.0/24, splits the address into 24 bits for the network portion and 8 bits for the host portion. To allocate 256 IPs, set this field to 8 (a /24 mask for IPv4 or a /120 for IPv6). Minimum value is 4 (16 IPs). This field is immutable. + pub per_node_host_bits: i32, +} + +impl crate::DeepMerge for ClusterCIDRSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ipv4, other.ipv4); + crate::DeepMerge::merge_from(&mut self.ipv6, other.ipv6); + crate::DeepMerge::merge_from(&mut self.node_selector, other.node_selector); + crate::DeepMerge::merge_from(&mut self.per_node_host_bits, other.per_node_host_bits); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterCIDRSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ipv4, + Key_ipv6, + Key_node_selector, + Key_per_node_host_bits, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ipv4" => Field::Key_ipv4, + "ipv6" => Field::Key_ipv6, + "nodeSelector" => Field::Key_node_selector, + "perNodeHostBits" => Field::Key_per_node_host_bits, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterCIDRSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ClusterCIDRSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ipv4: Option = None; + let mut value_ipv6: Option = None; + let mut value_node_selector: Option = None; + let mut value_per_node_host_bits: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ipv4 => value_ipv4 = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ipv6 => value_ipv6 = 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_per_node_host_bits => value_per_node_host_bits = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterCIDRSpec { + ipv4: value_ipv4, + ipv6: value_ipv6, + node_selector: value_node_selector, + per_node_host_bits: value_per_node_host_bits.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ClusterCIDRSpec", + &[ + "ipv4", + "ipv6", + "nodeSelector", + "perNodeHostBits", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterCIDRSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ClusterCIDRSpec", + 1 + + self.ipv4.as_ref().map_or(0, |_| 1) + + self.ipv6.as_ref().map_or(0, |_| 1) + + self.node_selector.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ipv4 { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipv4", value)?; + } + if let Some(value) = &self.ipv6 { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipv6", value)?; + } + if let Some(value) = &self.node_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelector", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "perNodeHostBits", &self.per_node_host_bits)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterCIDRSpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ClusterCIDRSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterCIDRSpec defines the desired state of ClusterCIDR.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ipv4".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPv4 defines an IPv4 IP block in CIDR notation(e.g. \"10.0.0.0/8\"). At least one of IPv4 and IPv6 must be specified. 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() + }), + ), + ( + "ipv6".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPv6 defines an IPv6 IP block in CIDR notation(e.g. \"fd12:3456:789a:1::/64\"). At least one of IPv4 and IPv6 must be specified. 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() + }), + ), + ( + "nodeSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeSelector defines which nodes the config is applicable to. An empty or nil NodeSelector selects all nodes. This field is immutable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "perNodeHostBits".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PerNodeHostBits defines the number of host bits to be configured per node. A subnet mask determines how much of the address is used for network bits and host bits. For example an IPv4 address of 192.168.0.0/24, splits the address into 24 bits for the network portion and 8 bits for the host portion. To allocate 256 IPs, set this field to 8 (a /24 mask for IPv4 or a /120 for IPv6). Minimum value is 4 (16 IPs). This field is immutable.".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: [ + "perNodeHostBits".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/networking/v1alpha1/mod.rs b/src/v1_25/api/networking/v1alpha1/mod.rs new file mode 100644 index 0000000000..c844d8c033 --- /dev/null +++ b/src/v1_25/api/networking/v1alpha1/mod.rs @@ -0,0 +1,7 @@ + +mod cluster_cidr; +pub use self::cluster_cidr::ClusterCIDR; +#[cfg(feature = "api")] pub use self::cluster_cidr::ReadClusterCIDRResponse; + +mod cluster_cidr_spec; +pub use self::cluster_cidr_spec::ClusterCIDRSpec; diff --git a/src/v1_25/api/node/mod.rs b/src/v1_25/api/node/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/node/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/node/v1/mod.rs b/src/v1_25/api/node/v1/mod.rs new file mode 100644 index 0000000000..a96372fa96 --- /dev/null +++ b/src/v1_25/api/node/v1/mod.rs @@ -0,0 +1,10 @@ + +mod overhead; +pub use self::overhead::Overhead; + +mod runtime_class; +pub use self::runtime_class::RuntimeClass; +#[cfg(feature = "api")] pub use self::runtime_class::ReadRuntimeClassResponse; + +mod scheduling; +pub use self::scheduling::Scheduling; diff --git a/src/v1_25/api/node/v1/overhead.rs b/src/v1_25/api/node/v1/overhead.rs new file mode 100644 index 0000000000..ef68cae1c1 --- /dev/null +++ b/src/v1_25/api/node/v1/overhead.rs @@ -0,0 +1,131 @@ +// 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::DeepMerge::merge_from(&mut self.pod_fixed, other.pod_fixed); + } +} + +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_25/api/node/v1/runtime_class.rs b/src/v1_25/api/node/v1/runtime_class.rs new file mode 100644 index 0000000000..470b9f902d --- /dev/null +++ b/src/v1_25/api/node/v1/runtime_class.rs @@ -0,0 +1,605 @@ +// 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, +} + +// Begin node.k8s.io/v1/RuntimeClass + +// Generated from operation createNodeV1RuntimeClass + +impl RuntimeClass { + /// create a RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::node::v1::RuntimeClass, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/node.k8s.io/v1/runtimeclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNodeV1CollectionRuntimeClass + +impl RuntimeClass { + /// delete collection of RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/node.k8s.io/v1/runtimeclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteNodeV1RuntimeClass + +impl RuntimeClass { + /// delete a RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RuntimeClass + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/node.k8s.io/v1/runtimeclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listNodeV1RuntimeClass + +impl RuntimeClass { + /// list or watch objects of kind RuntimeClass + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/node.k8s.io/v1/runtimeclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchNodeV1RuntimeClass + +impl RuntimeClass { + /// partially update the specified RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RuntimeClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/node.k8s.io/v1/runtimeclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readNodeV1RuntimeClass + +impl RuntimeClass { + /// read the specified RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadRuntimeClassResponse`]`>` constructor, or [`ReadRuntimeClassResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RuntimeClass + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/node.k8s.io/v1/runtimeclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`RuntimeClass::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadRuntimeClassResponse { + Ok(crate::api::node::v1::RuntimeClass), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadRuntimeClassResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadRuntimeClassResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadRuntimeClassResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceNodeV1RuntimeClass + +impl RuntimeClass { + /// replace the specified RuntimeClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RuntimeClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::node::v1::RuntimeClass, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/node.k8s.io/v1/runtimeclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchNodeV1RuntimeClass + +impl RuntimeClass { + /// list or watch objects of kind RuntimeClass + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/node.k8s.io/v1/runtimeclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End node.k8s.io/v1/RuntimeClass + +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_25/api/node/v1/scheduling.rs b/src/v1_25/api/node/v1/scheduling.rs new file mode 100644 index 0000000000..1c2b8a05c5 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.node_selector, other.node_selector); + crate::DeepMerge::merge_from(&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_25/api/policy/mod.rs b/src/v1_25/api/policy/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/policy/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/policy/v1/eviction.rs b/src/v1_25/api/policy/v1/eviction.rs new file mode 100644 index 0000000000..e92ebe2f3a --- /dev/null +++ b/src/v1_25/api/policy/v1/eviction.rs @@ -0,0 +1,267 @@ +// 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, +} + +// Begin policy/v1/Eviction + +// Generated from operation createCoreV1NamespacedPodEviction + +impl Eviction { + /// create eviction of a Pod + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Eviction + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create_pod( + name: &str, + namespace: &str, + body: &crate::api::policy::v1::Eviction, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/api/v1/namespaces/{namespace}/pods/{name}/eviction?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End policy/v1/Eviction + +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_25/api/policy/v1/mod.rs b/src/v1_25/api/policy/v1/mod.rs new file mode 100644 index 0000000000..5514146684 --- /dev/null +++ b/src/v1_25/api/policy/v1/mod.rs @@ -0,0 +1,14 @@ + +mod eviction; +pub use self::eviction::Eviction; + +mod pod_disruption_budget; +pub use self::pod_disruption_budget::PodDisruptionBudget; +#[cfg(feature = "api")] pub use self::pod_disruption_budget::ReadPodDisruptionBudgetResponse; +#[cfg(feature = "api")] pub use self::pod_disruption_budget::ReadPodDisruptionBudgetStatusResponse; + +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_25/api/policy/v1/pod_disruption_budget.rs b/src/v1_25/api/policy/v1/pod_disruption_budget.rs new file mode 100644 index 0000000000..72f7294f71 --- /dev/null +++ b/src/v1_25/api/policy/v1/pod_disruption_budget.rs @@ -0,0 +1,868 @@ +// 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, +} + +// Begin policy/v1/PodDisruptionBudget + +// Generated from operation createPolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// create a PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::policy::v1::PodDisruptionBudget, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deletePolicyV1CollectionNamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// delete collection of PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deletePolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// delete a PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listPolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// list or watch objects of kind PodDisruptionBudget + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listPolicyV1PodDisruptionBudgetForAllNamespaces + +impl PodDisruptionBudget { + /// list or watch objects of kind PodDisruptionBudget + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/policy/v1/poddisruptionbudgets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchPolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// partially update the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchPolicyV1NamespacedPodDisruptionBudgetStatus + +impl PodDisruptionBudget { + /// partially update status of the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readPolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// read the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodDisruptionBudgetResponse`]`>` constructor, or [`ReadPodDisruptionBudgetResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PodDisruptionBudget::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodDisruptionBudgetResponse { + Ok(crate::api::policy::v1::PodDisruptionBudget), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodDisruptionBudgetResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodDisruptionBudgetResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodDisruptionBudgetResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readPolicyV1NamespacedPodDisruptionBudgetStatus + +impl PodDisruptionBudget { + /// read status of the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodDisruptionBudgetStatusResponse`]`>` constructor, or [`ReadPodDisruptionBudgetStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PodDisruptionBudget::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPodDisruptionBudgetStatusResponse { + Ok(crate::api::policy::v1::PodDisruptionBudget), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPodDisruptionBudgetStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPodDisruptionBudgetStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPodDisruptionBudgetStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replacePolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// replace the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::policy::v1::PodDisruptionBudget, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replacePolicyV1NamespacedPodDisruptionBudgetStatus + +impl PodDisruptionBudget { + /// replace status of the specified PodDisruptionBudget + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PodDisruptionBudget + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + namespace: &str, + body: &crate::api::policy::v1::PodDisruptionBudget, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchPolicyV1NamespacedPodDisruptionBudget + +impl PodDisruptionBudget { + /// list or watch objects of kind PodDisruptionBudget + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchPolicyV1PodDisruptionBudgetForAllNamespaces + +impl PodDisruptionBudget { + /// list or watch objects of kind PodDisruptionBudget + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/policy/v1/poddisruptionbudgets?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End policy/v1/PodDisruptionBudget + +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_25/api/policy/v1/pod_disruption_budget_spec.rs b/src/v1_25/api/policy/v1/pod_disruption_budget_spec.rs new file mode 100644 index 0000000000..b7ecdf1049 --- /dev/null +++ b/src/v1_25/api/policy/v1/pod_disruption_budget_spec.rs @@ -0,0 +1,177 @@ +// 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, +} + +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); + } +} + +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, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> 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, + _ => 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; + + 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::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, + }) + } + } + + deserializer.deserialize_struct( + "PodDisruptionBudgetSpec", + &[ + "maxUnavailable", + "minAvailable", + "selector", + ], + 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), + )?; + 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)?; + } + 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) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_25/api/policy/v1/pod_disruption_budget_status.rs b/src/v1_25/api/policy/v1/pod_disruption_budget_status.rs new file mode 100644 index 0000000000..f4aa41a86e --- /dev/null +++ b/src/v1_25/api/policy/v1/pod_disruption_budget_status.rs @@ -0,0 +1,293 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&mut self.current_healthy, other.current_healthy); + crate::DeepMerge::merge_from(&mut self.desired_healthy, other.desired_healthy); + crate::DeepMerge::merge_from(&mut self.disrupted_pods, other.disrupted_pods); + 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_25/api/rbac/mod.rs b/src/v1_25/api/rbac/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/rbac/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/rbac/v1/aggregation_rule.rs b/src/v1_25/api/rbac/v1/aggregation_rule.rs new file mode 100644 index 0000000000..5ccc4984f6 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/api/rbac/v1/cluster_role.rs b/src/v1_25/api/rbac/v1/cluster_role.rs new file mode 100644 index 0000000000..8336e14c92 --- /dev/null +++ b/src/v1_25/api/rbac/v1/cluster_role.rs @@ -0,0 +1,585 @@ +// 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>, +} + +// Begin rbac.authorization.k8s.io/v1/ClusterRole + +// Generated from operation createRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// create a ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::rbac::v1::ClusterRole, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterroles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// delete a ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRole + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1CollectionClusterRole + +impl ClusterRole { + /// delete collection of ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterroles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// list or watch objects of kind ClusterRole + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterroles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// partially update the specified ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRole + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// read the specified ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadClusterRoleResponse`]`>` constructor, or [`ReadClusterRoleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRole + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ClusterRole::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadClusterRoleResponse { + Ok(crate::api::rbac::v1::ClusterRole), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadClusterRoleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadClusterRoleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadClusterRoleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// replace the specified ClusterRole + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRole + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::rbac::v1::ClusterRole, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1ClusterRole + +impl ClusterRole { + /// list or watch objects of kind ClusterRole + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterroles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End rbac.authorization.k8s.io/v1/ClusterRole + +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::DeepMerge::merge_from(&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_25/api/rbac/v1/cluster_role_binding.rs b/src/v1_25/api/rbac/v1/cluster_role_binding.rs new file mode 100644 index 0000000000..0162a1128e --- /dev/null +++ b/src/v1_25/api/rbac/v1/cluster_role_binding.rs @@ -0,0 +1,583 @@ +// 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. + pub role_ref: crate::api::rbac::v1::RoleRef, + + /// Subjects holds references to the objects the role applies to. + pub subjects: Option>, +} + +// Begin rbac.authorization.k8s.io/v1/ClusterRoleBinding + +// Generated from operation createRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// create a ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::rbac::v1::ClusterRoleBinding, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// delete a ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRoleBinding + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1CollectionClusterRoleBinding + +impl ClusterRoleBinding { + /// delete collection of ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// list or watch objects of kind ClusterRoleBinding + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// partially update the specified ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRoleBinding + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// read the specified ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadClusterRoleBindingResponse`]`>` constructor, or [`ReadClusterRoleBindingResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRoleBinding + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`ClusterRoleBinding::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadClusterRoleBindingResponse { + Ok(crate::api::rbac::v1::ClusterRoleBinding), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadClusterRoleBindingResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadClusterRoleBindingResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadClusterRoleBindingResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// replace the specified ClusterRoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the ClusterRoleBinding + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::rbac::v1::ClusterRoleBinding, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1ClusterRoleBinding + +impl ClusterRoleBinding { + /// list or watch objects of kind ClusterRoleBinding + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End rbac.authorization.k8s.io/v1/ClusterRoleBinding + +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::DeepMerge::merge_from(&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.".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_25/api/rbac/v1/mod.rs b/src/v1_25/api/rbac/v1/mod.rs new file mode 100644 index 0000000000..b4d2cf36ca --- /dev/null +++ b/src/v1_25/api/rbac/v1/mod.rs @@ -0,0 +1,28 @@ + +mod aggregation_rule; +pub use self::aggregation_rule::AggregationRule; + +mod cluster_role; +pub use self::cluster_role::ClusterRole; +#[cfg(feature = "api")] pub use self::cluster_role::ReadClusterRoleResponse; + +mod cluster_role_binding; +pub use self::cluster_role_binding::ClusterRoleBinding; +#[cfg(feature = "api")] pub use self::cluster_role_binding::ReadClusterRoleBindingResponse; + +mod policy_rule; +pub use self::policy_rule::PolicyRule; + +mod role; +pub use self::role::Role; +#[cfg(feature = "api")] pub use self::role::ReadRoleResponse; + +mod role_binding; +pub use self::role_binding::RoleBinding; +#[cfg(feature = "api")] pub use self::role_binding::ReadRoleBindingResponse; + +mod role_ref; +pub use self::role_ref::RoleRef; + +mod subject; +pub use self::subject::Subject; diff --git a/src/v1_25/api/rbac/v1/policy_rule.rs b/src/v1_25/api/rbac/v1/policy_rule.rs new file mode 100644 index 0000000000..486e987c66 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.non_resource_urls, other.non_resource_urls); + crate::DeepMerge::merge_from(&mut self.resource_names, other.resource_names); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&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_25/api/rbac/v1/role.rs b/src/v1_25/api/rbac/v1/role.rs new file mode 100644 index 0000000000..9764bc7aa0 --- /dev/null +++ b/src/v1_25/api/rbac/v1/role.rs @@ -0,0 +1,676 @@ +// 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>, +} + +// Begin rbac.authorization.k8s.io/v1/Role + +// Generated from operation createRbacAuthorizationV1NamespacedRole + +impl Role { + /// create a Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::rbac::v1::Role, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1CollectionNamespacedRole + +impl Role { + /// delete collection of Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1NamespacedRole + +impl Role { + /// delete a Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Role + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1NamespacedRole + +impl Role { + /// list or watch objects of kind Role + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1RoleForAllNamespaces + +impl Role { + /// list or watch objects of kind Role + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/roles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchRbacAuthorizationV1NamespacedRole + +impl Role { + /// partially update the specified Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Role + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readRbacAuthorizationV1NamespacedRole + +impl Role { + /// read the specified Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadRoleResponse`]`>` constructor, or [`ReadRoleResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Role + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`Role::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadRoleResponse { + Ok(crate::api::rbac::v1::Role), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadRoleResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadRoleResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadRoleResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceRbacAuthorizationV1NamespacedRole + +impl Role { + /// replace the specified Role + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the Role + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::rbac::v1::Role, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1NamespacedRole + +impl Role { + /// list or watch objects of kind Role + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1RoleForAllNamespaces + +impl Role { + /// list or watch objects of kind Role + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/roles?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End rbac.authorization.k8s.io/v1/Role + +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::DeepMerge::merge_from(&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_25/api/rbac/v1/role_binding.rs b/src/v1_25/api/rbac/v1/role_binding.rs new file mode 100644 index 0000000000..ac11e857c2 --- /dev/null +++ b/src/v1_25/api/rbac/v1/role_binding.rs @@ -0,0 +1,699 @@ +// 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. + pub role_ref: crate::api::rbac::v1::RoleRef, + + /// Subjects holds references to the objects the role applies to. + pub subjects: Option>, +} + +// Begin rbac.authorization.k8s.io/v1/RoleBinding + +// Generated from operation createRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// create a RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::rbac::v1::RoleBinding, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1CollectionNamespacedRoleBinding + +impl RoleBinding { + /// delete collection of RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// delete a RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RoleBinding + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// list or watch objects of kind RoleBinding + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listRbacAuthorizationV1RoleBindingForAllNamespaces + +impl RoleBinding { + /// list or watch objects of kind RoleBinding + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/rolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// partially update the specified RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RoleBinding + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// read the specified RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadRoleBindingResponse`]`>` constructor, or [`ReadRoleBindingResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RoleBinding + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`RoleBinding::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadRoleBindingResponse { + Ok(crate::api::rbac::v1::RoleBinding), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadRoleBindingResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadRoleBindingResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadRoleBindingResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// replace the specified RoleBinding + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the RoleBinding + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::rbac::v1::RoleBinding, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1NamespacedRoleBinding + +impl RoleBinding { + /// list or watch objects of kind RoleBinding + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchRbacAuthorizationV1RoleBindingForAllNamespaces + +impl RoleBinding { + /// list or watch objects of kind RoleBinding + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/rolebindings?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End rbac.authorization.k8s.io/v1/RoleBinding + +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::DeepMerge::merge_from(&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.".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_25/api/rbac/v1/role_ref.rs b/src/v1_25/api/rbac/v1/role_ref.rs new file mode 100644 index 0000000000..5873e89211 --- /dev/null +++ b/src/v1_25/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_25/api/rbac/v1/subject.rs b/src/v1_25/api/rbac/v1/subject.rs new file mode 100644 index 0000000000..30b29a672b --- /dev/null +++ b/src/v1_25/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_25/api/scheduling/mod.rs b/src/v1_25/api/scheduling/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/api/scheduling/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/api/scheduling/v1/mod.rs b/src/v1_25/api/scheduling/v1/mod.rs new file mode 100644 index 0000000000..3780873f3e --- /dev/null +++ b/src/v1_25/api/scheduling/v1/mod.rs @@ -0,0 +1,4 @@ + +mod priority_class; +pub use self::priority_class::PriorityClass; +#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_25/api/scheduling/v1/priority_class.rs b/src/v1_25/api/scheduling/v1/priority_class.rs new file mode 100644 index 0000000000..f13f535704 --- /dev/null +++ b/src/v1_25/api/scheduling/v1/priority_class.rs @@ -0,0 +1,630 @@ +// 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, + + /// The 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, +} + +// Begin scheduling.k8s.io/v1/PriorityClass + +// Generated from operation createSchedulingV1PriorityClass + +impl PriorityClass { + /// create a PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::scheduling::v1::PriorityClass, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/v1/priorityclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteSchedulingV1CollectionPriorityClass + +impl PriorityClass { + /// delete collection of PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/v1/priorityclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteSchedulingV1PriorityClass + +impl PriorityClass { + /// delete a PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityClass + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/scheduling.k8s.io/v1/priorityclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listSchedulingV1PriorityClass + +impl PriorityClass { + /// list or watch objects of kind PriorityClass + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/v1/priorityclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchSchedulingV1PriorityClass + +impl PriorityClass { + /// partially update the specified PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/scheduling.k8s.io/v1/priorityclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readSchedulingV1PriorityClass + +impl PriorityClass { + /// read the specified PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadPriorityClassResponse`]`>` constructor, or [`ReadPriorityClassResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityClass + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/scheduling.k8s.io/v1/priorityclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`PriorityClass::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadPriorityClassResponse { + Ok(crate::api::scheduling::v1::PriorityClass), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadPriorityClassResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadPriorityClassResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadPriorityClassResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceSchedulingV1PriorityClass + +impl PriorityClass { + /// replace the specified PriorityClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the PriorityClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::scheduling::v1::PriorityClass, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/scheduling.k8s.io/v1/priorityclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchSchedulingV1PriorityClass + +impl PriorityClass { + /// list or watch objects of kind PriorityClass + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/v1/priorityclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End scheduling.k8s.io/v1/PriorityClass + +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("The 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_25/api/storage/mod.rs b/src/v1_25/api/storage/mod.rs new file mode 100644 index 0000000000..1dcffc250b --- /dev/null +++ b/src/v1_25/api/storage/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1beta1; diff --git a/src/v1_25/api/storage/v1/csi_driver.rs b/src/v1_25/api/storage/v1/csi_driver.rs new file mode 100644 index 0000000000..0dc419fa28 --- /dev/null +++ b/src/v1_25/api/storage/v1/csi_driver.rs @@ -0,0 +1,554 @@ +// 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, + + /// Specification of the CSI Driver. + pub spec: crate::api::storage::v1::CSIDriverSpec, +} + +// Begin storage.k8s.io/v1/CSIDriver + +// Generated from operation createStorageV1CSIDriver + +impl CSIDriver { + /// create a CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::storage::v1::CSIDriver, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csidrivers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CSIDriver + +impl CSIDriver { + /// delete a CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIDriver + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csidrivers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CollectionCSIDriver + +impl CSIDriver { + /// delete collection of CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csidrivers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1CSIDriver + +impl CSIDriver { + /// list or watch objects of kind CSIDriver + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csidrivers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1CSIDriver + +impl CSIDriver { + /// partially update the specified CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIDriver + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csidrivers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1CSIDriver + +impl CSIDriver { + /// read the specified CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCSIDriverResponse`]`>` constructor, or [`ReadCSIDriverResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIDriver + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csidrivers/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CSIDriver::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCSIDriverResponse { + Ok(crate::api::storage::v1::CSIDriver), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCSIDriverResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCSIDriverResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCSIDriverResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1CSIDriver + +impl CSIDriver { + /// replace the specified CSIDriver + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIDriver + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::storage::v1::CSIDriver, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csidrivers/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1CSIDriver + +impl CSIDriver { + /// list or watch objects of kind CSIDriver + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csidrivers?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1/CSIDriver + +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("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_25/api/storage/v1/csi_driver_spec.rs b/src/v1_25/api/storage/v1/csi_driver_spec.rs new file mode 100644 index 0000000000..e3b4955632 --- /dev/null +++ b/src/v1_25/api/storage/v1/csi_driver_spec.rs @@ -0,0 +1,350 @@ +// 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, + + /// 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 is immutable. + /// + /// 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, + + /// If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. 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 VolumeConext 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 is immutable. + 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, + + /// If set to true, 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. + /// + /// 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::DeepMerge::merge_from(&mut self.token_requests, other.token_requests); + crate::DeepMerge::merge_from(&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("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 is immutable.\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("If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. 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 VolumeConext 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 is immutable.".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("If set to true, 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.\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. 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.\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( + 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_25/api/storage/v1/csi_node.rs b/src/v1_25/api/storage/v1/csi_node.rs new file mode 100644 index 0000000000..a514ce9bf0 --- /dev/null +++ b/src/v1_25/api/storage/v1/csi_node.rs @@ -0,0 +1,554 @@ +// 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 { + /// 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, +} + +// Begin storage.k8s.io/v1/CSINode + +// Generated from operation createStorageV1CSINode + +impl CSINode { + /// create a CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::storage::v1::CSINode, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csinodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CSINode + +impl CSINode { + /// delete a CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSINode + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csinodes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CollectionCSINode + +impl CSINode { + /// delete collection of CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csinodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1CSINode + +impl CSINode { + /// list or watch objects of kind CSINode + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csinodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1CSINode + +impl CSINode { + /// partially update the specified CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSINode + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csinodes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1CSINode + +impl CSINode { + /// read the specified CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCSINodeResponse`]`>` constructor, or [`ReadCSINodeResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSINode + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csinodes/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CSINode::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCSINodeResponse { + Ok(crate::api::storage::v1::CSINode), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCSINodeResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCSINodeResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCSINodeResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1CSINode + +impl CSINode { + /// replace the specified CSINode + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSINode + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::storage::v1::CSINode, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/csinodes/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1CSINode + +impl CSINode { + /// list or watch objects of kind CSINode + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csinodes?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1/CSINode + +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("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_25/api/storage/v1/csi_node_driver.rs b/src/v1_25/api/storage/v1/csi_node_driver.rs new file mode 100644 index 0000000000..c113299390 --- /dev/null +++ b/src/v1_25/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, + + /// This is 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::DeepMerge::merge_from(&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("This is 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_25/api/storage/v1/csi_node_spec.rs b/src/v1_25/api/storage/v1/csi_node_spec.rs new file mode 100644 index 0000000000..ea2a1ddb97 --- /dev/null +++ b/src/v1_25/api/storage/v1/csi_node_spec.rs @@ -0,0 +1,132 @@ +// 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::DeepMerge::merge_from(&mut self.drivers, other.drivers); + } +} + +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_25/api/storage/v1/csi_storage_capacity.rs b/src/v1_25/api/storage/v1/csi_storage_capacity.rs new file mode 100644 index 0000000000..02efa5277e --- /dev/null +++ b/src/v1_25/api/storage/v1/csi_storage_capacity.rs @@ -0,0 +1,761 @@ +// 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 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, + + /// 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, +} + +// Begin storage.k8s.io/v1/CSIStorageCapacity + +// Generated from operation createStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// create a CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::storage::v1::CSIStorageCapacity, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CollectionNamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// delete collection of CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// delete a CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1CSIStorageCapacityForAllNamespaces + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csistoragecapacities?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// partially update the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// read the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCSIStorageCapacityResponse`]`>` constructor, or [`ReadCSIStorageCapacityResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CSIStorageCapacity::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCSIStorageCapacityResponse { + Ok(crate::api::storage::v1::CSIStorageCapacity), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCSIStorageCapacityResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCSIStorageCapacityResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCSIStorageCapacityResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// replace the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::storage::v1::CSIStorageCapacity, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1CSIStorageCapacityForAllNamespaces + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/csistoragecapacities?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1/CSIStorageCapacity + +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 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("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_25/api/storage/v1/mod.rs b/src/v1_25/api/storage/v1/mod.rs new file mode 100644 index 0000000000..673d1d25b1 --- /dev/null +++ b/src/v1_25/api/storage/v1/mod.rs @@ -0,0 +1,48 @@ + +mod csi_driver; +pub use self::csi_driver::CSIDriver; +#[cfg(feature = "api")] pub use self::csi_driver::ReadCSIDriverResponse; + +mod csi_driver_spec; +pub use self::csi_driver_spec::CSIDriverSpec; + +mod csi_node; +pub use self::csi_node::CSINode; +#[cfg(feature = "api")] pub use self::csi_node::ReadCSINodeResponse; + +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; +#[cfg(feature = "api")] pub use self::csi_storage_capacity::ReadCSIStorageCapacityResponse; + +mod storage_class; +pub use self::storage_class::StorageClass; +#[cfg(feature = "api")] pub use self::storage_class::ReadStorageClassResponse; + +mod token_request; +pub use self::token_request::TokenRequest; + +mod volume_attachment; +pub use self::volume_attachment::VolumeAttachment; +#[cfg(feature = "api")] pub use self::volume_attachment::ReadVolumeAttachmentResponse; +#[cfg(feature = "api")] pub use self::volume_attachment::ReadVolumeAttachmentStatusResponse; + +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_25/api/storage/v1/storage_class.rs b/src/v1_25/api/storage/v1/storage_class.rs new file mode 100644 index 0000000000..2bf8e65456 --- /dev/null +++ b/src/v1_25/api/storage/v1/storage_class.rs @@ -0,0 +1,728 @@ +// 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, + + /// 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, + + /// Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, 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, + + /// Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. 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, +} + +// Begin storage.k8s.io/v1/StorageClass + +// Generated from operation createStorageV1StorageClass + +impl StorageClass { + /// create a StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::storage::v1::StorageClass, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/storageclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CollectionStorageClass + +impl StorageClass { + /// delete collection of StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/storageclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1StorageClass + +impl StorageClass { + /// delete a StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageClass + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/storageclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1StorageClass + +impl StorageClass { + /// list or watch objects of kind StorageClass + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/storageclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1StorageClass + +impl StorageClass { + /// partially update the specified StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/storageclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1StorageClass + +impl StorageClass { + /// read the specified StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadStorageClassResponse`]`>` constructor, or [`ReadStorageClassResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageClass + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/storageclasses/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`StorageClass::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadStorageClassResponse { + Ok(crate::api::storage::v1::StorageClass), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadStorageClassResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadStorageClassResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadStorageClassResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1StorageClass + +impl StorageClass { + /// replace the specified StorageClass + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the StorageClass + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::storage::v1::StorageClass, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/storageclasses/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1StorageClass + +impl StorageClass { + /// list or watch objects of kind StorageClass + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/storageclasses?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1/StorageClass + +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::DeepMerge::merge_from(&mut self.allowed_topologies, other.allowed_topologies); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.mount_options, other.mount_options); + crate::DeepMerge::merge_from(&mut self.parameters, other.parameters); + 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("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("Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, 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("Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. 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_25/api/storage/v1/token_request.rs b/src/v1_25/api/storage/v1/token_request.rs new file mode 100644 index 0000000000..cd0871f7a3 --- /dev/null +++ b/src/v1_25/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_25/api/storage/v1/volume_attachment.rs b/src/v1_25/api/storage/v1/volume_attachment.rs new file mode 100644 index 0000000000..f6b6972639 --- /dev/null +++ b/src/v1_25/api/storage/v1/volume_attachment.rs @@ -0,0 +1,734 @@ +// 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, + + /// Specification of the desired attach/detach volume behavior. Populated by the Kubernetes system. + pub spec: crate::api::storage::v1::VolumeAttachmentSpec, + + /// Status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher. + pub status: Option, +} + +// Begin storage.k8s.io/v1/VolumeAttachment + +// Generated from operation createStorageV1VolumeAttachment + +impl VolumeAttachment { + /// create a VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::api::storage::v1::VolumeAttachment, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/volumeattachments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1CollectionVolumeAttachment + +impl VolumeAttachment { + /// delete collection of VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/volumeattachments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1VolumeAttachment + +impl VolumeAttachment { + /// delete a VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1VolumeAttachment + +impl VolumeAttachment { + /// list or watch objects of kind VolumeAttachment + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/volumeattachments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1VolumeAttachment + +impl VolumeAttachment { + /// partially update the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1VolumeAttachmentStatus + +impl VolumeAttachment { + /// partially update status of the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1VolumeAttachment + +impl VolumeAttachment { + /// read the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadVolumeAttachmentResponse`]`>` constructor, or [`ReadVolumeAttachmentResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`VolumeAttachment::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadVolumeAttachmentResponse { + Ok(crate::api::storage::v1::VolumeAttachment), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadVolumeAttachmentResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadVolumeAttachmentResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadVolumeAttachmentResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readStorageV1VolumeAttachmentStatus + +impl VolumeAttachment { + /// read status of the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadVolumeAttachmentStatusResponse`]`>` constructor, or [`ReadVolumeAttachmentStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`VolumeAttachment::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadVolumeAttachmentStatusResponse { + Ok(crate::api::storage::v1::VolumeAttachment), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadVolumeAttachmentStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadVolumeAttachmentStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadVolumeAttachmentStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1VolumeAttachment + +impl VolumeAttachment { + /// replace the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::api::storage::v1::VolumeAttachment, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceStorageV1VolumeAttachmentStatus + +impl VolumeAttachment { + /// replace status of the specified VolumeAttachment + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the VolumeAttachment + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::api::storage::v1::VolumeAttachment, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1/volumeattachments/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1VolumeAttachment + +impl VolumeAttachment { + /// list or watch objects of kind VolumeAttachment + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/volumeattachments?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1/VolumeAttachment + +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("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 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_25/api/storage/v1/volume_attachment_source.rs b/src/v1_25/api/storage/v1/volume_attachment_source.rs new file mode 100644 index 0000000000..230f08111a --- /dev/null +++ b/src/v1_25/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, + + /// 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("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_25/api/storage/v1/volume_attachment_spec.rs b/src/v1_25/api/storage/v1/volume_attachment_spec.rs new file mode 100644 index 0000000000..4319ee3d8f --- /dev/null +++ b/src/v1_25/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, + + /// 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("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_25/api/storage/v1/volume_attachment_status.rs b/src/v1_25/api/storage/v1/volume_attachment_status.rs new file mode 100644 index 0000000000..fb8e63d745 --- /dev/null +++ b/src/v1_25/api/storage/v1/volume_attachment_status.rs @@ -0,0 +1,212 @@ +// 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 { + /// 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, + + /// 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, + + /// Upon successful attach, this field is populated with any information returned by the attach operation 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>, + + /// 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::DeepMerge::merge_from(&mut self.attachment_metadata, other.attachment_metadata); + 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("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("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("Upon successful attach, this field is populated with any information returned by the attach operation 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("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_25/api/storage/v1/volume_error.rs b/src/v1_25/api/storage/v1/volume_error.rs new file mode 100644 index 0000000000..3ced91e431 --- /dev/null +++ b/src/v1_25/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 { + /// String detailing the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information. + pub message: Option, + + /// 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("String detailing 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 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_25/api/storage/v1/volume_node_resources.rs b/src/v1_25/api/storage/v1/volume_node_resources.rs new file mode 100644 index 0000000000..b390320813 --- /dev/null +++ b/src/v1_25/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 { + /// 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("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_25/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs new file mode 100644 index 0000000000..3fdc471ce4 --- /dev/null +++ b/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs @@ -0,0 +1,761 @@ +// Generated from definition io.k8s.api.storage.v1beta1.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 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, + + /// 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, +} + +// Begin storage.k8s.io/v1beta1/CSIStorageCapacity + +// Generated from operation createStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// create a CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + namespace: &str, + body: &crate::api::storage::v1beta1::CSIStorageCapacity, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1beta1CollectionNamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// delete collection of CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + namespace: &str, + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// delete a CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + namespace: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1beta1CSIStorageCapacityForAllNamespaces + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list_for_all_namespaces( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1beta1/csistoragecapacities?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + namespace: &str, + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// partially update the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + namespace: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// read the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCSIStorageCapacityResponse`]`>` constructor, or [`ReadCSIStorageCapacityResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + #[cfg(feature = "api")] + pub fn read( + name: &str, + namespace: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CSIStorageCapacity::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCSIStorageCapacityResponse { + Ok(crate::api::storage::v1beta1::CSIStorageCapacity), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCSIStorageCapacityResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCSIStorageCapacityResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCSIStorageCapacityResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// replace the specified CSIStorageCapacity + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CSIStorageCapacity + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + namespace: &str, + body: &crate::api::storage::v1beta1::CSIStorageCapacity, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1beta1CSIStorageCapacityForAllNamespaces + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch_for_all_namespaces( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1beta1/csistoragecapacities?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchStorageV1beta1NamespacedCSIStorageCapacity + +impl CSIStorageCapacity { + /// list or watch objects of kind CSIStorageCapacity + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `namespace` + /// + /// object name and auth scope, such as for teams and projects + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + namespace: &str, + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/storage.k8s.io/v1beta1/namespaces/{namespace}/csistoragecapacities?", + namespace = crate::percent_encoding::percent_encode(namespace.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End storage.k8s.io/v1beta1/CSIStorageCapacity + +impl crate::Resource for CSIStorageCapacity { + const API_VERSION: &'static str = "storage.k8s.io/v1beta1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "CSIStorageCapacity"; + const VERSION: &'static str = "v1beta1"; + 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.v1beta1.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 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("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_25/api/storage/v1beta1/mod.rs b/src/v1_25/api/storage/v1beta1/mod.rs new file mode 100644 index 0000000000..a96a6424c7 --- /dev/null +++ b/src/v1_25/api/storage/v1beta1/mod.rs @@ -0,0 +1,4 @@ + +mod csi_storage_capacity; +pub use self::csi_storage_capacity::CSIStorageCapacity; +#[cfg(feature = "api")] pub use self::csi_storage_capacity::ReadCSIStorageCapacityResponse; diff --git a/src/v1_25/apiextensions_apiserver/mod.rs b/src/v1_25/apiextensions_apiserver/mod.rs new file mode 100644 index 0000000000..38fda62c15 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_column_definition.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_column_definition.rs new file mode 100644 index 0000000000..df7ac2e7db --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_conversion.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_conversion.rs new file mode 100644 index 0000000000..f4e10da6ed --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs new file mode 100644 index 0000000000..c05e8ea174 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -0,0 +1,732 @@ +// 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, +} + +// Begin apiextensions.k8s.io/v1/CustomResourceDefinition + +// Generated from operation createApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// create a CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteApiextensionsV1CollectionCustomResourceDefinition + +impl CustomResourceDefinition { + /// delete collection of CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// delete a CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// list or watch objects of kind CustomResourceDefinition + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// partially update the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchApiextensionsV1CustomResourceDefinitionStatus + +impl CustomResourceDefinition { + /// partially update status of the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// read the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCustomResourceDefinitionResponse`]`>` constructor, or [`ReadCustomResourceDefinitionResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CustomResourceDefinition::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCustomResourceDefinitionResponse { + Ok(crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCustomResourceDefinitionResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCustomResourceDefinitionResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCustomResourceDefinitionResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readApiextensionsV1CustomResourceDefinitionStatus + +impl CustomResourceDefinition { + /// read status of the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadCustomResourceDefinitionStatusResponse`]`>` constructor, or [`ReadCustomResourceDefinitionStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`CustomResourceDefinition::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadCustomResourceDefinitionStatusResponse { + Ok(crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadCustomResourceDefinitionStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadCustomResourceDefinitionStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadCustomResourceDefinitionStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// replace the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceApiextensionsV1CustomResourceDefinitionStatus + +impl CustomResourceDefinition { + /// replace status of the specified CustomResourceDefinition + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the CustomResourceDefinition + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchApiextensionsV1CustomResourceDefinition + +impl CustomResourceDefinition { + /// list or watch objects of kind CustomResourceDefinition + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apiextensions.k8s.io/v1/CustomResourceDefinition + +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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_condition.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_condition.rs new file mode 100644 index 0000000000..977e76323e --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_names.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_names.rs new file mode 100644 index 0000000000..f3a8d38696 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_spec.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_spec.rs new file mode 100644 index 0000000000..40ffea9ed1 --- /dev/null +++ b/src/v1_25/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/access-kubernetes-api/custom-resources/custom-resource-definitions/#pruning-versus-preserving-unknown-fields 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::DeepMerge::merge_from(&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/access-kubernetes-api/custom-resources/custom-resource-definitions/#pruning-versus-preserving-unknown-fields 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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs new file mode 100644 index 0000000000..a7427347aa --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs @@ -0,0 +1,190 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::DeepMerge::merge_from(&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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs new file mode 100644 index 0000000000..5b4d51a697 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs @@ -0,0 +1,303 @@ +// 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, + + /// 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::DeepMerge::merge_from(&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::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_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, + "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_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_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, + served: value_served.unwrap_or_default(), + storage: value_storage.unwrap_or_default(), + subresources: value_subresources, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionVersion", + &[ + "additionalPrinterColumns", + "deprecated", + "deprecationWarning", + "name", + "schema", + "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.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)?; + } + 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) + }, + ), + ( + "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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_scale.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_scale.rs new file mode 100644 index 0000000000..3a463e63fc --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_status.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_status.rs new file mode 100644 index 0000000000..8983293b88 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresources.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresources.rs new file mode 100644 index 0000000000..2133dac778 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_validation.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_validation.rs new file mode 100644 index 0000000000..52df6af7c8 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/external_documentation.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/external_documentation.rs new file mode 100644 index 0000000000..1b9d11980d --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json.rs new file mode 100644 index 0000000000..2988519355 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs new file mode 100644 index 0000000000..3c8b45d0b0 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs @@ -0,0 +1,1107 @@ +// 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::DeepMerge::merge_from(&mut self.all_of, other.all_of); + crate::DeepMerge::merge_from(&mut self.any_of, other.any_of); + crate::DeepMerge::merge_from(&mut self.default, other.default); + crate::DeepMerge::merge_from(&mut self.definitions, other.definitions); + crate::DeepMerge::merge_from(&mut self.dependencies, other.dependencies); + crate::DeepMerge::merge_from(&mut self.description, other.description); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.one_of, other.one_of); + crate::DeepMerge::merge_from(&mut self.pattern, other.pattern); + crate::DeepMerge::merge_from(&mut self.pattern_properties, other.pattern_properties); + crate::DeepMerge::merge_from(&mut self.properties, other.properties); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.x_kubernetes_validations, other.x_kubernetes_validations); + } +} + +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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_array.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_array.rs new file mode 100644 index 0000000000..29e24daf07 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_bool.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_bool.rs new file mode 100644 index 0000000000..dc5aab4ccb --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_string_array.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_string_array.rs new file mode 100644 index 0000000000..16a729c7a5 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs new file mode 100644 index 0000000000..658cc6488f --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -0,0 +1,68 @@ + +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; +#[cfg(feature = "api")] pub use self::custom_resource_definition::ReadCustomResourceDefinitionResponse; +#[cfg(feature = "api")] pub use self::custom_resource_definition::ReadCustomResourceDefinitionStatusResponse; + +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 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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/service_reference.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/service_reference.rs new file mode 100644 index 0000000000..31207824e2 --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs new file mode 100644 index 0000000000..f2d5c072b6 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs @@ -0,0 +1,177 @@ +// 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 { + /// 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, + + /// 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. + pub rule: String, +} + +impl crate::DeepMerge for ValidationRule { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.message, other.message); + 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_message, + 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 { + "message" => Field::Key_message, + "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_message: Option = None; + let mut value_rule: 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_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 { + message: value_message, + rule: value_rule.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ValidationRule", + &[ + "message", + "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.message.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", 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: [ + ( + "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() + }), + ), + ( + "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.".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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_client_config.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_client_config.rs new file mode 100644 index 0000000000..82887d059c --- /dev/null +++ b/src/v1_25/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_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_conversion.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_conversion.rs new file mode 100644 index 0000000000..aec75dfd39 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/apiextensions_apiserver/pkg/apis/mod.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/mod.rs new file mode 100644 index 0000000000..c7af5e8808 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod apiextensions; diff --git a/src/v1_25/apiextensions_apiserver/pkg/mod.rs b/src/v1_25/apiextensions_apiserver/pkg/mod.rs new file mode 100644 index 0000000000..42354b5991 --- /dev/null +++ b/src/v1_25/apiextensions_apiserver/pkg/mod.rs @@ -0,0 +1 @@ +pub mod apis; diff --git a/src/v1_25/apimachinery/mod.rs b/src/v1_25/apimachinery/mod.rs new file mode 100644 index 0000000000..38fda62c15 --- /dev/null +++ b/src/v1_25/apimachinery/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_25/apimachinery/pkg/api/mod.rs b/src/v1_25/apimachinery/pkg/api/mod.rs new file mode 100644 index 0000000000..c6bee0532e --- /dev/null +++ b/src/v1_25/apimachinery/pkg/api/mod.rs @@ -0,0 +1 @@ +pub mod resource; diff --git a/src/v1_25/apimachinery/pkg/api/resource/mod.rs b/src/v1_25/apimachinery/pkg/api/resource/mod.rs new file mode 100644 index 0000000000..629eeca5bc --- /dev/null +++ b/src/v1_25/apimachinery/pkg/api/resource/mod.rs @@ -0,0 +1,3 @@ + +mod quantity; +pub use self::quantity::Quantity; diff --git a/src/v1_25/apimachinery/pkg/api/resource/quantity.rs b/src/v1_25/apimachinery/pkg/api/resource/quantity.rs new file mode 100644 index 0000000000..fc5595f21b --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/mod.rs b/src/v1_25/apimachinery/pkg/apis/meta/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/apimachinery/pkg/apis/meta/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/apimachinery/pkg/apis/meta/v1/api_group.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/api_group.rs new file mode 100644 index 0000000000..3d36440e87 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.server_address_by_client_cidrs, other.server_address_by_client_cidrs); + crate::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/api_group_list.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/api_group_list.rs new file mode 100644 index 0000000000..167aeeabe0 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/api_resource.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/api_resource.rs new file mode 100644 index 0000000000..e679e8aa73 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/api_resource_list.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/api_resource_list.rs new file mode 100644 index 0000000000..a34ba733a3 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/api_versions.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/api_versions.rs new file mode 100644 index 0000000000..a2d355ee8d --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&mut self.server_address_by_client_cidrs, other.server_address_by_client_cidrs); + crate::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/condition.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/condition.rs new file mode 100644 index 0000000000..5774276420 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/delete_options.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/delete_options.rs new file mode 100644 index 0000000000..04abc8215b --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/fields_v1.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/fields_v1.rs new file mode 100644 index 0000000000..51a376ce4a --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/group_version_for_discovery.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/group_version_for_discovery.rs new file mode 100644 index 0000000000..eb5dc7f3b8 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/label_selector.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/label_selector.rs new file mode 100644 index 0000000000..877caad4dd --- /dev/null +++ b/src/v1_25/apimachinery/pkg/apis/meta/v1/label_selector.rs @@ -0,0 +1,165 @@ +// 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::DeepMerge::merge_from(&mut self.match_expressions, other.match_expressions); + crate::DeepMerge::merge_from(&mut self.match_labels, other.match_labels); + } +} + +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_25/apimachinery/pkg/apis/meta/v1/label_selector_requirement.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/label_selector_requirement.rs new file mode 100644 index 0000000000..6570daea42 --- /dev/null +++ b/src/v1_25/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::DeepMerge::merge_from(&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_25/apimachinery/pkg/apis/meta/v1/list_meta.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/list_meta.rs new file mode 100644 index 0000000000..726530b0dc --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/managed_fields_entry.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/managed_fields_entry.rs new file mode 100644 index 0000000000..c225336b90 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/micro_time.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/micro_time.rs new file mode 100644 index 0000000000..01cfa4b681 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/mod.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/mod.rs new file mode 100644 index 0000000000..9424127582 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/object_meta.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/object_meta.rs new file mode 100644 index 0000000000..8d7007f3a3 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/apis/meta/v1/object_meta.rs @@ -0,0 +1,528 @@ +// 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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/identifiers#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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/identifiers#uids + pub uid: Option, +} + +impl crate::DeepMerge for ObjectMeta { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.annotations, other.annotations); + 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::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.labels, other.labels); + crate::DeepMerge::merge_from(&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::DeepMerge::merge_from(&mut self.owner_references, other.owner_references); + 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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/identifiers#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: http://kubernetes.io/docs/user-guide/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: http://kubernetes.io/docs/user-guide/identifiers#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_25/apimachinery/pkg/apis/meta/v1/owner_reference.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/owner_reference.rs new file mode 100644 index 0000000000..6c07fd614a --- /dev/null +++ b/src/v1_25/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: http://kubernetes.io/docs/user-guide/identifiers#names + pub name: String, + + /// UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#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: http://kubernetes.io/docs/user-guide/identifiers#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: http://kubernetes.io/docs/user-guide/identifiers#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_25/apimachinery/pkg/apis/meta/v1/patch.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/patch.rs new file mode 100644 index 0000000000..19ce061442 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/preconditions.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/preconditions.rs new file mode 100644 index 0000000000..b87f240cf9 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/server_address_by_client_cidr.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/server_address_by_client_cidr.rs new file mode 100644 index 0000000000..50642ef290 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/status.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/status.rs new file mode 100644 index 0000000000..979f072bfb --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/status_cause.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/status_cause.rs new file mode 100644 index 0000000000..83b1407f75 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/status_details.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/status_details.rs new file mode 100644 index 0000000000..183b525d2c --- /dev/null +++ b/src/v1_25/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: http://kubernetes.io/docs/user-guide/identifiers#uids + pub uid: Option, +} + +impl crate::DeepMerge for StatusDetails { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&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: http://kubernetes.io/docs/user-guide/identifiers#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_25/apimachinery/pkg/apis/meta/v1/time.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/time.rs new file mode 100644 index 0000000000..802d9addf7 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/apis/meta/v1/watch_event.rs b/src/v1_25/apimachinery/pkg/apis/meta/v1/watch_event.rs new file mode 100644 index 0000000000..e2548f5269 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/apis/meta/v1/watch_event.rs @@ -0,0 +1,408 @@ +// 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 { 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 { + 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 { resource_version } => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "BOOKMARK")?; + let object = BookmarkObject { + metadata: BookmarkObjectMeta { + 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> { + 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", + &[ + "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_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 { + "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_resource_version: 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::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(BookmarkObjectMeta { + resource_version: std::borrow::Cow::Owned(value_resource_version.ok_or_else(|| crate::serde::de::Error::missing_field("resourceVersion"))?), + }) + } + } + + deserializer.deserialize_struct( + "ObjectMeta", + &[ + "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", + 1, + )?; + 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_25/apimachinery/pkg/apis/mod.rs b/src/v1_25/apimachinery/pkg/apis/mod.rs new file mode 100644 index 0000000000..6b50816f81 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod meta; diff --git a/src/v1_25/apimachinery/pkg/mod.rs b/src/v1_25/apimachinery/pkg/mod.rs new file mode 100644 index 0000000000..99522b9afa --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/runtime/mod.rs b/src/v1_25/apimachinery/pkg/runtime/mod.rs new file mode 100644 index 0000000000..eb2b8c0503 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/runtime/mod.rs @@ -0,0 +1,3 @@ + +mod raw_extension; +pub use self::raw_extension::RawExtension; diff --git a/src/v1_25/apimachinery/pkg/runtime/raw_extension.rs b/src/v1_25/apimachinery/pkg/runtime/raw_extension.rs new file mode 100644 index 0000000000..4eee36e101 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/util/intstr/int_or_string.rs b/src/v1_25/apimachinery/pkg/util/intstr/int_or_string.rs new file mode 100644 index 0000000000..bc75855787 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/util/intstr/int_or_string.rs @@ -0,0 +1,97 @@ +// 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 { + write!(formatter, "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 { + if v < i64::from(i32::min_value()) || v > i64::from(i32::max_value()) { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Signed(v), &"a 32-bit integer")); + } + + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + Ok(IntOrString::Int(v as i32)) + } + + fn visit_u64(self, v: u64) -> Result where E: crate::serde::de::Error { + #[allow(clippy::cast_sign_loss)] + { + if v > i32::max_value() as u64 { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Unsigned(v), &"a 32-bit integer")); + } + } + + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + Ok(IntOrString::Int(v as i32)) + } + + 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() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("int-or-string".to_owned()), + ..Default::default() + }) + } +} diff --git a/src/v1_25/apimachinery/pkg/util/intstr/mod.rs b/src/v1_25/apimachinery/pkg/util/intstr/mod.rs new file mode 100644 index 0000000000..d3f7196121 --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/util/mod.rs b/src/v1_25/apimachinery/pkg/util/mod.rs new file mode 100644 index 0000000000..a1d5337d02 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/util/mod.rs @@ -0,0 +1 @@ +pub mod intstr; diff --git a/src/v1_25/apimachinery/pkg/version/info.rs b/src/v1_25/apimachinery/pkg/version/info.rs new file mode 100644 index 0000000000..6a666fbece --- /dev/null +++ b/src/v1_25/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_25/apimachinery/pkg/version/mod.rs b/src/v1_25/apimachinery/pkg/version/mod.rs new file mode 100644 index 0000000000..f125e577d1 --- /dev/null +++ b/src/v1_25/apimachinery/pkg/version/mod.rs @@ -0,0 +1,3 @@ + +mod info; +pub use self::info::Info; diff --git a/src/v1_25/create_optional.rs b/src/v1_25/create_optional.rs new file mode 100644 index 0000000000..0d7db46031 --- /dev/null +++ b/src/v1_25/create_optional.rs @@ -0,0 +1,37 @@ +// Generated from definition io.k8s.CreateOptional + +/// Common parameters for all create operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct CreateOptional<'a> { + /// 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<&'a str>, + + /// fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. + pub field_manager: Option<&'a str>, + + /// fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. + pub field_validation: Option<&'a str>, +} + +#[cfg(feature = "api")] +impl<'a> CreateOptional<'a> { + #[doc(hidden)] + /// Serializes this object to a [`crate::url::form_urlencoded::Serializer`] + /// + /// This function is only exposed for use by the `k8s-openapi-derive` crate and is not part of the stable public API. + pub fn __serialize( + self, + __query_pairs: &mut crate::url::form_urlencoded::Serializer<'_, T>, + ) where T: crate::url::form_urlencoded::Target { + if let Some(value) = self.dry_run { + __query_pairs.append_pair("dryRun", value); + } + if let Some(value) = self.field_manager { + __query_pairs.append_pair("fieldManager", value); + } + if let Some(value) = self.field_validation { + __query_pairs.append_pair("fieldValidation", value); + } + } +} diff --git a/src/v1_25/create_response.rs b/src/v1_25/create_response.rs new file mode 100644 index 0000000000..e14f340ca4 --- /dev/null +++ b/src/v1_25/create_response.rs @@ -0,0 +1,57 @@ +// Generated from definition io.k8s.CreateResponse + +/// The common response type for all create API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum CreateResponse where T: crate::serde::de::DeserializeOwned { + Ok(T), + Created(T), + Accepted(T), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for CreateResponse where T: crate::serde::de::DeserializeOwned { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((CreateResponse::Ok(result), buf.len())) + }, + http::StatusCode::CREATED => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((CreateResponse::Created(result), buf.len())) + }, + http::StatusCode::ACCEPTED => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((CreateResponse::Accepted(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((CreateResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/delete_optional.rs b/src/v1_25/delete_optional.rs new file mode 100644 index 0000000000..9f986148bc --- /dev/null +++ b/src/v1_25/delete_optional.rs @@ -0,0 +1,64 @@ +// Generated from definition io.k8s.DeleteOptional + +/// Common parameters for all delete and delete-collection operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct DeleteOptional<'a> { + /// 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<&'a str>, + + /// 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<&'a [String]>, + + /// 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<&'a str>, + + /// 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<&'a crate::apimachinery::pkg::apis::meta::v1::Preconditions>, + + /// 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<&'a str>, +} + +impl<'a> crate::serde::Serialize for DeleteOptional<'a> { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeleteOptional", + 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) + } +} diff --git a/src/v1_25/delete_response.rs b/src/v1_25/delete_response.rs new file mode 100644 index 0000000000..d983465bd8 --- /dev/null +++ b/src/v1_25/delete_response.rs @@ -0,0 +1,59 @@ +// Generated from definition io.k8s.DeleteResponse + +/// The common response type for all delete API operations and delete-collection API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum DeleteResponse where T: crate::serde::de::DeserializeOwned { + OkStatus(crate::apimachinery::pkg::apis::meta::v1::Status), + OkValue(T), + Accepted(T), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for DeleteResponse where T: crate::serde::de::DeserializeOwned { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result: crate::serde_json::Map = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + let is_status = matches!(result.get("kind"), Some(crate::serde_json::Value::String(s)) if s == "Status"); + if is_status { + let result = crate::serde::Deserialize::deserialize(crate::serde_json::Value::Object(result)); + let result = result.map_err(crate::ResponseError::Json)?; + Ok((DeleteResponse::OkStatus(result), buf.len())) + } + else { + let result = crate::serde::Deserialize::deserialize(crate::serde_json::Value::Object(result)); + let result = result.map_err(crate::ResponseError::Json)?; + Ok((DeleteResponse::OkValue(result), buf.len())) + } + }, + http::StatusCode::ACCEPTED => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((DeleteResponse::Accepted(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((DeleteResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/kube_aggregator/mod.rs b/src/v1_25/kube_aggregator/mod.rs new file mode 100644 index 0000000000..38fda62c15 --- /dev/null +++ b/src/v1_25/kube_aggregator/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_25/kube_aggregator/pkg/apis/apiregistration/mod.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/mod.rs new file mode 100644 index 0000000000..a3a6d96c3f --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs new file mode 100644 index 0000000000..cff7ff1489 --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -0,0 +1,734 @@ +// 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, +} + +// Begin apiregistration.k8s.io/v1/APIService + +// Generated from operation createApiregistrationV1APIService + +impl APIService { + /// create an APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::CreateResponse`]`>` constructor, or [`crate::CreateResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn create( + body: &crate::kube_aggregator::pkg::apis::apiregistration::v1::APIService, + optional: crate::CreateOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/v1/apiservices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::post(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteApiregistrationV1APIService + +impl APIService { + /// delete an APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete( + name: &str, + optional: crate::DeleteOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::delete(__url); + let __body = if optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation deleteApiregistrationV1CollectionAPIService + +impl APIService { + /// delete collection of APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`<`[`crate::List`]`>>` constructor, or [`crate::DeleteResponse`]`<`[`crate::List`]`>` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `delete_optional` + /// + /// Delete options. Use `Default::default()` to not pass any. + /// + /// * `list_optional` + /// + /// List options. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn delete_collection( + delete_optional: crate::DeleteOptional<'_>, + list_optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>>), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/v1/apiservices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + list_optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::delete(__url); + let __body = if delete_optional == Default::default() { + vec![] + } + else { + crate::serde_json::to_vec(&delete_optional).map_err(crate::RequestError::Json)? + }; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation listApiregistrationV1APIService + +impl APIService { + /// list or watch objects of kind APIService + /// + /// This operation only supports listing all items of this type. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ListResponse`]`>` constructor, or [`crate::ListResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn list( + optional: crate::ListOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/v1/apiservices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchApiregistrationV1APIService + +impl APIService { + /// partially update the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation patchApiregistrationV1APIServiceStatus + +impl APIService { + /// partially update status of the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn patch_status( + name: &str, + body: &crate::apimachinery::pkg::apis::meta::v1::Patch, + optional: crate::PatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::patch(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static(match body { + crate::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + crate::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation readApiregistrationV1APIService + +impl APIService { + /// read the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadAPIServiceResponse`]`>` constructor, or [`ReadAPIServiceResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + #[cfg(feature = "api")] + pub fn read( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`APIService::read`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadAPIServiceResponse { + Ok(crate::kube_aggregator::pkg::apis::apiregistration::v1::APIService), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadAPIServiceResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadAPIServiceResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadAPIServiceResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation readApiregistrationV1APIServiceStatus + +impl APIService { + /// read status of the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`ReadAPIServiceStatusResponse`]`>` constructor, or [`ReadAPIServiceStatusResponse`] directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + #[cfg(feature = "api")] + pub fn read_status( + name: &str, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}/status", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`APIService::read_status`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReadAPIServiceStatusResponse { + Ok(crate::kube_aggregator::pkg::apis::apiregistration::v1::APIService), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReadAPIServiceStatusResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReadAPIServiceStatusResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReadAPIServiceStatusResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation replaceApiregistrationV1APIService + +impl APIService { + /// replace the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace( + name: &str, + body: &crate::kube_aggregator::pkg::apis::apiregistration::v1::APIService, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation replaceApiregistrationV1APIServiceStatus + +impl APIService { + /// replace status of the specified APIService + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `name` + /// + /// name of the APIService + /// + /// * `body` + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn replace_status( + name: &str, + body: &crate::kube_aggregator::pkg::apis::apiregistration::v1::APIService, + optional: crate::ReplaceOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = format!("/apis/apiregistration.k8s.io/v1/apiservices/{name}/status?", + name = crate::percent_encoding::percent_encode(name.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::put(__url); + let __body = crate::serde_json::to_vec(body).map_err(crate::RequestError::Json)?; + let __request = __request.header(crate::http::header::CONTENT_TYPE, crate::http::header::HeaderValue::from_static("application/json")); + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// Generated from operation watchApiregistrationV1APIService + +impl APIService { + /// list or watch objects of kind APIService + /// + /// This operation only supports watching one item, or a list of items, of this type for changes. + /// + /// Use the returned [`crate::ResponseBody`]`<`[`crate::WatchResponse`]`>` constructor, or [`crate::WatchResponse`]`` directly, to parse the HTTP response. + /// + /// # Arguments + /// + /// * `optional` + /// + /// Optional parameters. Use `Default::default()` to not pass any. + #[cfg(feature = "api")] + pub fn watch( + optional: crate::WatchOptional<'_>, + ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/v1/apiservices?".to_owned(); + let mut __query_pairs = crate::url::form_urlencoded::Serializer::new(__url); + optional.__serialize(&mut __query_pairs); + let __url = __query_pairs.finish(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } + } +} + +// End apiregistration.k8s.io/v1/APIService + +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_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_condition.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_condition.rs new file mode 100644 index 0000000000..8c70ff0ac2 --- /dev/null +++ b/src/v1_25/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_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_spec.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_spec.rs new file mode 100644 index 0000000000..fd14dc3952 --- /dev/null +++ b/src/v1_25/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, + + /// GroupPriorityMininum 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 GroupPriorityMininum 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("GroupPriorityMininum 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 GroupPriorityMininum 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_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs new file mode 100644 index 0000000000..658b6ca9ce --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs @@ -0,0 +1,131 @@ +// 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::DeepMerge::merge_from(&mut self.conditions, other.conditions); + } +} + +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_25/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs new file mode 100644 index 0000000000..e48afb5807 --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -0,0 +1,17 @@ + +mod api_service; +pub use self::api_service::APIService; +#[cfg(feature = "api")] pub use self::api_service::ReadAPIServiceResponse; +#[cfg(feature = "api")] pub use self::api_service::ReadAPIServiceStatusResponse; + +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_25/kube_aggregator/pkg/apis/apiregistration/v1/service_reference.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/service_reference.rs new file mode 100644 index 0000000000..b528db4a9a --- /dev/null +++ b/src/v1_25/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_25/kube_aggregator/pkg/apis/mod.rs b/src/v1_25/kube_aggregator/pkg/apis/mod.rs new file mode 100644 index 0000000000..fb7673a7a1 --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod apiregistration; diff --git a/src/v1_25/kube_aggregator/pkg/mod.rs b/src/v1_25/kube_aggregator/pkg/mod.rs new file mode 100644 index 0000000000..42354b5991 --- /dev/null +++ b/src/v1_25/kube_aggregator/pkg/mod.rs @@ -0,0 +1 @@ +pub mod apis; diff --git a/src/v1_25/list.rs b/src/v1_25/list.rs new file mode 100644 index 0000000000..cc10bf672f --- /dev/null +++ b/src/v1_25/list.rs @@ -0,0 +1,143 @@ +// 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::ListableResource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.items, other.items); + 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_25/list_optional.rs b/src/v1_25/list_optional.rs new file mode 100644 index 0000000000..b7e631d5ba --- /dev/null +++ b/src/v1_25/list_optional.rs @@ -0,0 +1,69 @@ +// Generated from definition io.k8s.ListOptional + +/// Common parameters for all list operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct ListOptional<'a> { + /// The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". + /// + /// This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. + pub continue_: Option<&'a str>, + + /// A selector to restrict the list of returned objects by their fields. Defaults to everything. + pub field_selector: Option<&'a str>, + + /// A selector to restrict the list of returned objects by their labels. Defaults to everything. + pub label_selector: Option<&'a str>, + + /// limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. + /// + /// The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. + pub limit: Option, + + /// resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. + /// + /// Defaults to unset + pub resource_version: Option<&'a str>, + + /// resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. + /// + /// Defaults to unset + pub resource_version_match: Option<&'a str>, + + /// Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. + pub timeout_seconds: Option, +} + +#[cfg(feature = "api")] +impl<'a> ListOptional<'a> { + #[doc(hidden)] + /// Serializes this object to a [`crate::url::form_urlencoded::Serializer`] + /// + /// This function is only exposed for use by the `k8s-openapi-derive` crate and is not part of the stable public API. + pub fn __serialize( + self, + __query_pairs: &mut crate::url::form_urlencoded::Serializer<'_, T>, + ) where T: crate::url::form_urlencoded::Target { + if let Some(value) = self.continue_ { + __query_pairs.append_pair("continue", value); + } + if let Some(value) = self.field_selector { + __query_pairs.append_pair("fieldSelector", value); + } + if let Some(value) = self.label_selector { + __query_pairs.append_pair("labelSelector", value); + } + if let Some(value) = self.limit { + __query_pairs.append_pair("limit", &value.to_string()); + } + if let Some(value) = self.resource_version { + __query_pairs.append_pair("resourceVersion", value); + } + if let Some(value) = self.resource_version_match { + __query_pairs.append_pair("resourceVersionMatch", value); + } + if let Some(value) = self.timeout_seconds { + __query_pairs.append_pair("timeoutSeconds", &value.to_string()); + } + } +} diff --git a/src/v1_25/list_response.rs b/src/v1_25/list_response.rs new file mode 100644 index 0000000000..a7b671f29c --- /dev/null +++ b/src/v1_25/list_response.rs @@ -0,0 +1,39 @@ +// Generated from definition io.k8s.ListResponse + +/// The common response type for all list API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ListResponse where T: crate::serde::de::DeserializeOwned + crate::ListableResource { + Ok(crate::List), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ListResponse where T: crate::serde::de::DeserializeOwned + crate::ListableResource { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ListResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ListResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/mod.rs b/src/v1_25/mod.rs new file mode 100644 index 0000000000..4a7b2a9af5 --- /dev/null +++ b/src/v1_25/mod.rs @@ -0,0 +1,3046 @@ + +#[cfg(feature = "api")] +mod create_optional; +#[cfg(feature = "api")] +pub use self::create_optional::CreateOptional; + +#[cfg(feature = "api")] +mod create_response; +#[cfg(feature = "api")] +pub use self::create_response::CreateResponse; + +#[cfg(feature = "api")] +mod delete_optional; +#[cfg(feature = "api")] +pub use self::delete_optional::DeleteOptional; + +#[cfg(feature = "api")] +mod delete_response; +#[cfg(feature = "api")] +pub use self::delete_response::DeleteResponse; + +mod list; +pub use self::list::List; + +#[cfg(feature = "api")] +mod list_optional; +#[cfg(feature = "api")] +pub use self::list_optional::ListOptional; + +#[cfg(feature = "api")] +mod list_response; +#[cfg(feature = "api")] +pub use self::list_response::ListResponse; + +#[cfg(feature = "api")] +mod patch_optional; +#[cfg(feature = "api")] +pub use self::patch_optional::PatchOptional; + +#[cfg(feature = "api")] +mod patch_response; +#[cfg(feature = "api")] +pub use self::patch_response::PatchResponse; + +#[cfg(feature = "api")] +mod replace_optional; +#[cfg(feature = "api")] +pub use self::replace_optional::ReplaceOptional; + +#[cfg(feature = "api")] +mod replace_response; +#[cfg(feature = "api")] +pub use self::replace_response::ReplaceResponse; + +#[cfg(feature = "api")] +mod watch_optional; +#[cfg(feature = "api")] +pub use self::watch_optional::WatchOptional; + +#[cfg(feature = "api")] +mod watch_response; +#[cfg(feature = "api")] +pub use self::watch_response::WatchResponse; + +pub mod api; + +pub mod apiextensions_apiserver; + +pub mod apimachinery; + +pub mod kube_aggregator; + +// Generated from operation getAPIVersions + +/// get available API versions +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAPIVersionsResponse`]`>` constructor, or [`GetAPIVersionsResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_api_versions( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_api_versions`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAPIVersionsResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroupList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAPIVersionsResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAPIVersionsResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAPIVersionsResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAdmissionregistrationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAdmissionregistrationAPIGroupResponse`]`>` constructor, or [`GetAdmissionregistrationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_admissionregistration_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_admissionregistration_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAdmissionregistrationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAdmissionregistrationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAdmissionregistrationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAdmissionregistrationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAdmissionregistrationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAdmissionregistrationV1APIResourcesResponse`]`>` constructor, or [`GetAdmissionregistrationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_admissionregistration_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/admissionregistration.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_admissionregistration_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAdmissionregistrationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAdmissionregistrationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAdmissionregistrationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAdmissionregistrationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getApiextensionsAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetApiextensionsAPIGroupResponse`]`>` constructor, or [`GetApiextensionsAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apiextensions_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apiextensions_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetApiextensionsAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetApiextensionsAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetApiextensionsAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetApiextensionsAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getApiextensionsV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetApiextensionsV1APIResourcesResponse`]`>` constructor, or [`GetApiextensionsV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apiextensions_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apiextensions.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apiextensions_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetApiextensionsV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetApiextensionsV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetApiextensionsV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetApiextensionsV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getApiregistrationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetApiregistrationAPIGroupResponse`]`>` constructor, or [`GetApiregistrationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apiregistration_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apiregistration_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetApiregistrationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetApiregistrationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetApiregistrationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetApiregistrationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getApiregistrationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetApiregistrationV1APIResourcesResponse`]`>` constructor, or [`GetApiregistrationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apiregistration_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apiregistration.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apiregistration_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetApiregistrationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetApiregistrationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetApiregistrationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetApiregistrationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAppsAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAppsAPIGroupResponse`]`>` constructor, or [`GetAppsAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apps_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apps/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apps_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAppsAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAppsAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAppsAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAppsAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAppsV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAppsV1APIResourcesResponse`]`>` constructor, or [`GetAppsV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_apps_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/apps/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_apps_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAppsV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAppsV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAppsV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAppsV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAuthenticationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthenticationAPIGroupResponse`]`>` constructor, or [`GetAuthenticationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_authentication_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/authentication.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_authentication_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAuthenticationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAuthenticationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAuthenticationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAuthenticationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAuthenticationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthenticationV1APIResourcesResponse`]`>` constructor, or [`GetAuthenticationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_authentication_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/authentication.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_authentication_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAuthenticationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAuthenticationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAuthenticationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAuthenticationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAuthorizationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthorizationAPIGroupResponse`]`>` constructor, or [`GetAuthorizationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_authorization_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/authorization.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_authorization_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAuthorizationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAuthorizationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAuthorizationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAuthorizationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAuthorizationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthorizationV1APIResourcesResponse`]`>` constructor, or [`GetAuthorizationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_authorization_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/authorization.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_authorization_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAuthorizationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAuthorizationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAuthorizationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAuthorizationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAutoscalingAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingAPIGroupResponse`]`>` constructor, or [`GetAutoscalingAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_autoscaling_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/autoscaling/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_autoscaling_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAutoscalingAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAutoscalingAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAutoscalingAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAutoscalingAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAutoscalingV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV1APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_autoscaling_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/autoscaling/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_autoscaling_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAutoscalingV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAutoscalingV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAutoscalingV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAutoscalingV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAutoscalingV2APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV2APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV2APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_autoscaling_v2_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/autoscaling/v2/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_autoscaling_v2_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAutoscalingV2APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAutoscalingV2APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAutoscalingV2APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAutoscalingV2APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getAutoscalingV2beta2APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV2beta2APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV2beta2APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_autoscaling_v2beta2_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/autoscaling/v2beta2/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_autoscaling_v2beta2_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetAutoscalingV2beta2APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetAutoscalingV2beta2APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetAutoscalingV2beta2APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetAutoscalingV2beta2APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getBatchAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetBatchAPIGroupResponse`]`>` constructor, or [`GetBatchAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_batch_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/batch/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_batch_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetBatchAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetBatchAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetBatchAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetBatchAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getBatchV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetBatchV1APIResourcesResponse`]`>` constructor, or [`GetBatchV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_batch_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/batch/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_batch_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetBatchV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetBatchV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetBatchV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetBatchV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCertificatesAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCertificatesAPIGroupResponse`]`>` constructor, or [`GetCertificatesAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_certificates_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_certificates_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCertificatesAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCertificatesAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCertificatesAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCertificatesAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCertificatesV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCertificatesV1APIResourcesResponse`]`>` constructor, or [`GetCertificatesV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_certificates_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/certificates.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_certificates_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCertificatesV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCertificatesV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCertificatesV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCertificatesV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCodeVersion + +/// get the code version +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCodeVersionResponse`]`>` constructor, or [`GetCodeVersionResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_code_version( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/version/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_code_version`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCodeVersionResponse { + Ok(crate::apimachinery::pkg::version::Info), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCodeVersionResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCodeVersionResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCodeVersionResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCoordinationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCoordinationAPIGroupResponse`]`>` constructor, or [`GetCoordinationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_coordination_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/coordination.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_coordination_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCoordinationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCoordinationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCoordinationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCoordinationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCoordinationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCoordinationV1APIResourcesResponse`]`>` constructor, or [`GetCoordinationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_coordination_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/coordination.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_coordination_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCoordinationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCoordinationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCoordinationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCoordinationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCoreAPIVersions + +/// get available API versions +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCoreAPIVersionsResponse`]`>` constructor, or [`GetCoreAPIVersionsResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_core_api_versions( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/api/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_core_api_versions`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCoreAPIVersionsResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIVersions), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCoreAPIVersionsResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCoreAPIVersionsResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCoreAPIVersionsResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getCoreV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetCoreV1APIResourcesResponse`]`>` constructor, or [`GetCoreV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_core_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/api/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_core_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetCoreV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetCoreV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetCoreV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetCoreV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getDiscoveryAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetDiscoveryAPIGroupResponse`]`>` constructor, or [`GetDiscoveryAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_discovery_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/discovery.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_discovery_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetDiscoveryAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetDiscoveryAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetDiscoveryAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetDiscoveryAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getDiscoveryV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetDiscoveryV1APIResourcesResponse`]`>` constructor, or [`GetDiscoveryV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_discovery_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/discovery.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_discovery_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetDiscoveryV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetDiscoveryV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetDiscoveryV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetDiscoveryV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getEventsAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetEventsAPIGroupResponse`]`>` constructor, or [`GetEventsAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_events_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/events.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_events_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetEventsAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetEventsAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetEventsAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetEventsAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getEventsV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetEventsV1APIResourcesResponse`]`>` constructor, or [`GetEventsV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_events_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/events.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_events_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetEventsV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetEventsV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetEventsV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetEventsV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getFlowcontrolApiserverAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetFlowcontrolApiserverAPIGroupResponse`]`>` constructor, or [`GetFlowcontrolApiserverAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_flowcontrol_apiserver_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_flowcontrol_apiserver_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetFlowcontrolApiserverAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetFlowcontrolApiserverAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetFlowcontrolApiserverAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetFlowcontrolApiserverAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getFlowcontrolApiserverV1beta1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetFlowcontrolApiserverV1beta1APIResourcesResponse`]`>` constructor, or [`GetFlowcontrolApiserverV1beta1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_flowcontrol_apiserver_v1beta1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_flowcontrol_apiserver_v1beta1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetFlowcontrolApiserverV1beta1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetFlowcontrolApiserverV1beta1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetFlowcontrolApiserverV1beta1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetFlowcontrolApiserverV1beta1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getFlowcontrolApiserverV1beta2APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetFlowcontrolApiserverV1beta2APIResourcesResponse`]`>` constructor, or [`GetFlowcontrolApiserverV1beta2APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_flowcontrol_apiserver_v1beta2_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_flowcontrol_apiserver_v1beta2_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetFlowcontrolApiserverV1beta2APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetFlowcontrolApiserverV1beta2APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetFlowcontrolApiserverV1beta2APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetFlowcontrolApiserverV1beta2APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getInternalApiserverAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetInternalApiserverAPIGroupResponse`]`>` constructor, or [`GetInternalApiserverAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_internal_apiserver_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_internal_apiserver_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetInternalApiserverAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetInternalApiserverAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetInternalApiserverAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetInternalApiserverAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getInternalApiserverV1alpha1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetInternalApiserverV1alpha1APIResourcesResponse`]`>` constructor, or [`GetInternalApiserverV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_internal_apiserver_v1alpha1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/internal.apiserver.k8s.io/v1alpha1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_internal_apiserver_v1alpha1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetInternalApiserverV1alpha1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetInternalApiserverV1alpha1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetInternalApiserverV1alpha1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetInternalApiserverV1alpha1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getNetworkingAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetNetworkingAPIGroupResponse`]`>` constructor, or [`GetNetworkingAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_networking_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/networking.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_networking_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetNetworkingAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetNetworkingAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetNetworkingAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetNetworkingAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getNetworkingV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetNetworkingV1APIResourcesResponse`]`>` constructor, or [`GetNetworkingV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_networking_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_networking_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetNetworkingV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetNetworkingV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetNetworkingV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetNetworkingV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getNetworkingV1alpha1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetNetworkingV1alpha1APIResourcesResponse`]`>` constructor, or [`GetNetworkingV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_networking_v1alpha1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/networking.k8s.io/v1alpha1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_networking_v1alpha1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetNetworkingV1alpha1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetNetworkingV1alpha1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetNetworkingV1alpha1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetNetworkingV1alpha1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getNodeAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeAPIGroupResponse`]`>` constructor, or [`GetNodeAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_node_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/node.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_node_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetNodeAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetNodeAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetNodeAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetNodeAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getNodeV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1APIResourcesResponse`]`>` constructor, or [`GetNodeV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_node_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/node.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_node_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetNodeV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetNodeV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetNodeV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetNodeV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getPolicyAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetPolicyAPIGroupResponse`]`>` constructor, or [`GetPolicyAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_policy_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/policy/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_policy_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetPolicyAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetPolicyAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetPolicyAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetPolicyAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getPolicyV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetPolicyV1APIResourcesResponse`]`>` constructor, or [`GetPolicyV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_policy_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/policy/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_policy_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetPolicyV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetPolicyV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetPolicyV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetPolicyV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getRbacAuthorizationAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetRbacAuthorizationAPIGroupResponse`]`>` constructor, or [`GetRbacAuthorizationAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_rbac_authorization_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_rbac_authorization_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetRbacAuthorizationAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetRbacAuthorizationAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetRbacAuthorizationAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetRbacAuthorizationAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getRbacAuthorizationV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetRbacAuthorizationV1APIResourcesResponse`]`>` constructor, or [`GetRbacAuthorizationV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_rbac_authorization_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/rbac.authorization.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_rbac_authorization_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetRbacAuthorizationV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetRbacAuthorizationV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetRbacAuthorizationV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetRbacAuthorizationV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getSchedulingAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetSchedulingAPIGroupResponse`]`>` constructor, or [`GetSchedulingAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_scheduling_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_scheduling_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetSchedulingAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetSchedulingAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetSchedulingAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetSchedulingAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getSchedulingV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetSchedulingV1APIResourcesResponse`]`>` constructor, or [`GetSchedulingV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_scheduling_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/scheduling.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_scheduling_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetSchedulingV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetSchedulingV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetSchedulingV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetSchedulingV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getServiceAccountIssuerOpenIDConfiguration + +/// get service account issuer OpenID configuration, also known as the 'OIDC discovery doc' +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetServiceAccountIssuerOpenIDConfigurationResponse`]`>` constructor, or [`GetServiceAccountIssuerOpenIDConfigurationResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_service_account_issuer_open_id_configuration( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/.well-known/openid-configuration/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_service_account_issuer_open_id_configuration`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetServiceAccountIssuerOpenIDConfigurationResponse { + Ok(String), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetServiceAccountIssuerOpenIDConfigurationResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + if buf.is_empty() { + return Err(crate::ResponseError::NeedMoreData); + } + + let (result, len) = match std::str::from_utf8(buf) { + Ok(s) => (s, buf.len()), + Err(err) => match (err.valid_up_to(), err.error_len()) { + (0, Some(_)) => return Err(crate::ResponseError::Utf8(err)), + (0, None) => return Err(crate::ResponseError::NeedMoreData), + (valid_up_to, _) => ( + unsafe { std::str::from_utf8_unchecked(buf.get_unchecked(..valid_up_to)) }, + valid_up_to, + ), + }, + }; + Ok((GetServiceAccountIssuerOpenIDConfigurationResponse::Ok(result.to_owned()), len)) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetServiceAccountIssuerOpenIDConfigurationResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getServiceAccountIssuerOpenIDKeyset + +/// get service account issuer OpenID JSON Web Key Set (contains public token verification keys) +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetServiceAccountIssuerOpenIDKeysetResponse`]`>` constructor, or [`GetServiceAccountIssuerOpenIDKeysetResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_service_account_issuer_open_id_keyset( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/openid/v1/jwks/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_service_account_issuer_open_id_keyset`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetServiceAccountIssuerOpenIDKeysetResponse { + Ok(String), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetServiceAccountIssuerOpenIDKeysetResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + if buf.is_empty() { + return Err(crate::ResponseError::NeedMoreData); + } + + let (result, len) = match std::str::from_utf8(buf) { + Ok(s) => (s, buf.len()), + Err(err) => match (err.valid_up_to(), err.error_len()) { + (0, Some(_)) => return Err(crate::ResponseError::Utf8(err)), + (0, None) => return Err(crate::ResponseError::NeedMoreData), + (valid_up_to, _) => ( + unsafe { std::str::from_utf8_unchecked(buf.get_unchecked(..valid_up_to)) }, + valid_up_to, + ), + }, + }; + Ok((GetServiceAccountIssuerOpenIDKeysetResponse::Ok(result.to_owned()), len)) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetServiceAccountIssuerOpenIDKeysetResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getStorageAPIGroup + +/// get information of a group +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetStorageAPIGroupResponse`]`>` constructor, or [`GetStorageAPIGroupResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_storage_api_group( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/storage.k8s.io/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_storage_api_group`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetStorageAPIGroupResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetStorageAPIGroupResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetStorageAPIGroupResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetStorageAPIGroupResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getStorageV1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetStorageV1APIResourcesResponse`]`>` constructor, or [`GetStorageV1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_storage_v1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_storage_v1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetStorageV1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetStorageV1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetStorageV1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetStorageV1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation getStorageV1beta1APIResources + +/// get available resources +/// +/// Use the returned [`crate::ResponseBody`]`<`[`GetStorageV1beta1APIResourcesResponse`]`>` constructor, or [`GetStorageV1beta1APIResourcesResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn get_storage_v1beta1_api_resources( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/apis/storage.k8s.io/v1beta1/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`get_storage_v1beta1_api_resources`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum GetStorageV1beta1APIResourcesResponse { + Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for GetStorageV1beta1APIResourcesResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + crate::http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((GetStorageV1beta1APIResourcesResponse::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((GetStorageV1beta1APIResourcesResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation logFileHandler + +/// Use the returned [`crate::ResponseBody`]`<`[`LogFileHandlerResponse`]`>` constructor, or [`LogFileHandlerResponse`] directly, to parse the HTTP response. +/// +/// # Arguments +/// +/// * `logpath` +/// +/// path to the log +#[cfg(feature = "api")] +pub fn log_file_handler( + logpath: &str, +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = format!("/logs/{logpath}", + logpath = crate::percent_encoding::percent_encode(logpath.as_bytes(), crate::percent_encoding2::PATH_SEGMENT_ENCODE_SET), + ); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`log_file_handler`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum LogFileHandlerResponse { + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for LogFileHandlerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((LogFileHandlerResponse::Other(result), read)) + }, + } + } +} + +// Generated from operation logFileListHandler + +/// Use the returned [`crate::ResponseBody`]`<`[`LogFileListHandlerResponse`]`>` constructor, or [`LogFileListHandlerResponse`] directly, to parse the HTTP response. +#[cfg(feature = "api")] +pub fn log_file_list_handler( +) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { + let __url = "/logs/".to_owned(); + + let __request = crate::http::Request::get(__url); + let __body = vec![]; + match __request.body(__body) { + Ok(request) => Ok((request, crate::ResponseBody::new)), + Err(err) => Err(crate::RequestError::Http(err)), + } +} + +/// Use `::try_from_parts` to parse the HTTP response body of [`log_file_list_handler`] +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum LogFileListHandlerResponse { + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for LogFileListHandlerResponse { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((LogFileListHandlerResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/patch_optional.rs b/src/v1_25/patch_optional.rs new file mode 100644 index 0000000000..803f498f6c --- /dev/null +++ b/src/v1_25/patch_optional.rs @@ -0,0 +1,43 @@ +// Generated from definition io.k8s.PatchOptional + +/// Common parameters for all patch operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct PatchOptional<'a> { + /// 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<&'a str>, + + /// fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). + pub field_manager: Option<&'a str>, + + /// fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. + pub field_validation: Option<&'a str>, + + /// Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. + pub force: Option, +} + +#[cfg(feature = "api")] +impl<'a> PatchOptional<'a> { + #[doc(hidden)] + /// Serializes this object to a [`crate::url::form_urlencoded::Serializer`] + /// + /// This function is only exposed for use by the `k8s-openapi-derive` crate and is not part of the stable public API. + pub fn __serialize( + self, + __query_pairs: &mut crate::url::form_urlencoded::Serializer<'_, T>, + ) where T: crate::url::form_urlencoded::Target { + if let Some(value) = self.dry_run { + __query_pairs.append_pair("dryRun", value); + } + if let Some(value) = self.field_manager { + __query_pairs.append_pair("fieldManager", value); + } + if let Some(value) = self.field_validation { + __query_pairs.append_pair("fieldValidation", value); + } + if let Some(value) = self.force { + __query_pairs.append_pair("force", if value { "true" } else { "false" }); + } + } +} diff --git a/src/v1_25/patch_response.rs b/src/v1_25/patch_response.rs new file mode 100644 index 0000000000..d733843676 --- /dev/null +++ b/src/v1_25/patch_response.rs @@ -0,0 +1,48 @@ +// Generated from definition io.k8s.PatchResponse + +/// The common response type for all patch API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum PatchResponse where T: crate::serde::de::DeserializeOwned { + Ok(T), + Created(T), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for PatchResponse where T: crate::serde::de::DeserializeOwned { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((PatchResponse::Ok(result), buf.len())) + }, + http::StatusCode::CREATED => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((PatchResponse::Created(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((PatchResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/replace_optional.rs b/src/v1_25/replace_optional.rs new file mode 100644 index 0000000000..9a452099a7 --- /dev/null +++ b/src/v1_25/replace_optional.rs @@ -0,0 +1,37 @@ +// Generated from definition io.k8s.ReplaceOptional + +/// Common parameters for all replace operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct ReplaceOptional<'a> { + /// 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<&'a str>, + + /// fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. + pub field_manager: Option<&'a str>, + + /// fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. + pub field_validation: Option<&'a str>, +} + +#[cfg(feature = "api")] +impl<'a> ReplaceOptional<'a> { + #[doc(hidden)] + /// Serializes this object to a [`crate::url::form_urlencoded::Serializer`] + /// + /// This function is only exposed for use by the `k8s-openapi-derive` crate and is not part of the stable public API. + pub fn __serialize( + self, + __query_pairs: &mut crate::url::form_urlencoded::Serializer<'_, T>, + ) where T: crate::url::form_urlencoded::Target { + if let Some(value) = self.dry_run { + __query_pairs.append_pair("dryRun", value); + } + if let Some(value) = self.field_manager { + __query_pairs.append_pair("fieldManager", value); + } + if let Some(value) = self.field_validation { + __query_pairs.append_pair("fieldValidation", value); + } + } +} diff --git a/src/v1_25/replace_response.rs b/src/v1_25/replace_response.rs new file mode 100644 index 0000000000..bdbb0b341d --- /dev/null +++ b/src/v1_25/replace_response.rs @@ -0,0 +1,48 @@ +// Generated from definition io.k8s.ReplaceResponse + +/// The common response type for all replace API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum ReplaceResponse where T: crate::serde::de::DeserializeOwned { + Ok(T), + Created(T), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for ReplaceResponse where T: crate::serde::de::DeserializeOwned { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReplaceResponse::Ok(result), buf.len())) + }, + http::StatusCode::CREATED => { + let result = match crate::serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => return Err(crate::ResponseError::Json(err)), + }; + Ok((ReplaceResponse::Created(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((ReplaceResponse::Other(result), read)) + }, + } + } +} diff --git a/src/v1_25/watch_optional.rs b/src/v1_25/watch_optional.rs new file mode 100644 index 0000000000..36824963d9 --- /dev/null +++ b/src/v1_25/watch_optional.rs @@ -0,0 +1,52 @@ +// Generated from definition io.k8s.WatchOptional + +/// Common parameters for all watch operations. +#[cfg(feature = "api")] +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct WatchOptional<'a> { + /// allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. + pub allow_watch_bookmarks: Option, + + /// A selector to restrict the list of returned objects by their fields. Defaults to everything. + pub field_selector: Option<&'a str>, + + /// A selector to restrict the list of returned objects by their labels. Defaults to everything. + pub label_selector: Option<&'a str>, + + /// resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. + /// + /// Defaults to unset + pub resource_version: Option<&'a str>, + + /// Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. + pub timeout_seconds: Option, +} + +#[cfg(feature = "api")] +impl<'a> WatchOptional<'a> { + #[doc(hidden)] + /// Serializes this object to a [`crate::url::form_urlencoded::Serializer`] + /// + /// This function is only exposed for use by the `k8s-openapi-derive` crate and is not part of the stable public API. + pub fn __serialize( + self, + __query_pairs: &mut crate::url::form_urlencoded::Serializer<'_, T>, + ) where T: crate::url::form_urlencoded::Target { + if let Some(value) = self.allow_watch_bookmarks { + __query_pairs.append_pair("allowWatchBookmarks", if value { "true" } else { "false" }); + } + if let Some(value) = self.field_selector { + __query_pairs.append_pair("fieldSelector", value); + } + if let Some(value) = self.label_selector { + __query_pairs.append_pair("labelSelector", value); + } + if let Some(value) = self.resource_version { + __query_pairs.append_pair("resourceVersion", value); + } + if let Some(value) = self.timeout_seconds { + __query_pairs.append_pair("timeoutSeconds", &value.to_string()); + } + __query_pairs.append_pair("watch", "true"); + } +} diff --git a/src/v1_25/watch_response.rs b/src/v1_25/watch_response.rs new file mode 100644 index 0000000000..f8e1ddf9e2 --- /dev/null +++ b/src/v1_25/watch_response.rs @@ -0,0 +1,41 @@ +// Generated from definition io.k8s.WatchResponse + +/// The common response type for all watch API operations. +#[cfg(feature = "api")] +#[derive(Debug)] +pub enum WatchResponse where T: crate::serde::de::DeserializeOwned { + Ok(crate::apimachinery::pkg::apis::meta::v1::WatchEvent), + Other(Result, crate::serde_json::Error>), +} + +#[cfg(feature = "api")] +impl crate::Response for WatchResponse where T: crate::serde::de::DeserializeOwned { + fn try_from_parts(status_code: crate::http::StatusCode, buf: &[u8]) -> Result<(Self, usize), crate::ResponseError> { + match status_code { + http::StatusCode::OK => { + let mut deserializer = crate::serde_json::Deserializer::from_slice(buf).into_iter(); + let (result, byte_offset) = match deserializer.next() { + Some(Ok(value)) => (value, deserializer.byte_offset()), + Some(Err(err)) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Some(Err(err)) => return Err(crate::ResponseError::Json(err)), + None => return Err(crate::ResponseError::NeedMoreData), + }; + Ok((WatchResponse::Ok(result), byte_offset)) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match crate::serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(crate::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((WatchResponse::Other(result), read)) + }, + } + } +} diff --git a/test.sh b/test.sh index 7211391182..a8eaca06eb 100755 --- a/test.sh +++ b/test.sh @@ -48,6 +48,7 @@ declare -A K8S_VERSIONS=( ['1.22']='1.22.13' ['1.23']='1.23.10' ['1.24']='1.24.4' + ['1.25']='1.25.0' ) # https://github.com/kubernetes-sigs/kind/releases @@ -59,6 +60,7 @@ declare -A KIND_VERSIONS=( ['1.22']='0.14.0' ['1.23']='0.14.0' ['1.24']='0.14.0' + ['1.25']='0.14.0' ) # https://github.com/docker/buildx/releases