diff --git a/CHANGELOG.md b/CHANGELOG.md index 035bdfa068..90c5ce8816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -301,7 +301,7 @@ Corresponding Kubernetes API server versions: - BREAKING CHANGE: This version partially reverts the change in v0.9.0 that made `k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent` require `T: k8s_openapi::Resource`; now it only requires `T: serde::Deserialize<'de>` once more. This has been done to make it possible to use `WatchEvent` with custom user-provided resource types that do not implement `k8s_openapi::Resource`. - The `k8s_openapi::Resource` bound in v0.9.0 was added to be able to enforce that the `WatchEvent::::Bookmark` events contain the correct `apiVersion` and `kind` fields for the specified `T` during deserialization. Without the bound now, it is no longer possible to do that. So it is now possible to deserialize, say, a `WatchEvent::::Bookmark` as a `WatchEvent::::Bookmark` without any runtime error. Take care to deserialize `watch_*` API responses into the right `k8s_openapi::WatchResponse` type, such as by relying on the returned `k8s_openapi::ResponseBody` as documented in the crate docs. + The `k8s_openapi::Resource` bound in v0.9.0 was added to be able to enforce that the `WatchEvent::::Bookmark` events contain the correct `apiVersion` and `kind` fields for the specified `T` during deserialization. Without the bound now, it is no longer possible to do that. So it is now possible to deserialize, say, a `WatchEvent::::Bookmark` as a `WatchEvent::::Bookmark` without any runtime error. Take care to deserialize `watch_*` API responses into the right `crate::clientset::WatchResponse` type, such as by relying on the returned `k8s_openapi::ResponseBody` as documented in the crate docs. - BREAKING CHANGE: The `bytes` dependency has been updated to match the `tokio` v1 ecosystem. diff --git a/Cargo.toml b/Cargo.toml index cd5a25ceca..94ec81c5be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,21 +36,14 @@ chrono = { version = "0.4.1", default-features = false, features = [ "alloc", # for chrono::DateTime::::to_rfc3339_opts "serde", # for chrono::DateTime: serde::Deserialize, serde::Serialize ] } -http = { version = "0.2", optional = true, default-features = false } -percent-encoding = { version = "2", optional = true, default-features = false } schemars = { version = "0.8", optional = true, default-features = false } serde = { version = "1", default-features = false } serde_json = { version = "1", default-features = false, features = [ "alloc", # "serde_json requires that either `std` (default) or `alloc` feature is enabled" ] } serde-value = { version = "0.7", default-features = false } -url = { version = "2", optional = true, default-features = false } [features] -default = ["api"] - -api = ["http", "percent-encoding", "url"] # Enables API operation functions and response types. If disabled, only the resource types will be exported. - # Each feature corresponds to a supported version of Kubernetes earliest = ["v1_22"] v1_22 = [] diff --git a/README.md b/README.md index 785f064a78..f804a154a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This crate is a Rust Kubernetes API client. It contains bindings for the resources and operations in the Kubernetes client API, auto-generated from the OpenAPI spec. +This crate is a Rust Kubernetes API client. It contains bindings for the resources in the Kubernetes client API, auto-generated from the OpenAPI spec. [crates.io](https://crates.io/crates/k8s-openapi) @@ -17,59 +17,6 @@ The upstream OpenAPI spec is not written by hand; it's itself generated from the Since this crate uses a custom code generator, it is able to work around these mistakes and emit correct bindings. See the list of fixes [here](https://github.com/Arnavion/k8s-openapi/blob/master/k8s-openapi-codegen/src/fixups/upstream_bugs.rs) and the breakdown of fixes applied to each Kubernetes version [here.](https://github.com/Arnavion/k8s-openapi/blob/master/k8s-openapi-codegen/src/supported_version.rs) -### Better code organization, closer to the Go API - -Upstream's generated clients tend to place all the API operations in massive top-level modules. For example, the Python client contains a single [CoreV1Api class](https://github.com/kubernetes-client/python/blob/master/kubernetes/client/api/core_v1_api.py) with a couple of hundred methods, one for each `core/v1` API operation like `list_namespaced_pod`. - -This crate instead associates these functions with the corresponding resource type. The `list_namespaced_pod` function is accessed as `Pod::list`, where `Pod` is the resource type for pods. This is similar to the Go API's [PodInterface::List](https://godoc.org/k8s.io/client-go/kubernetes/typed/core/v1#PodInterface) - -Since all types are under the `io.k8s` namespace, this crate also removes those two components from the module path. The end result is that the path to `Pod` is `k8s_openapi::api::core::v1::Pod`, similar to the Go path `k8s.io/api/core/v1.Pod`. - - -### Better handling of optional parameters, for a more Rust-like and ergonomic API - -Almost every API operation has optional parameters. For example, v1.23's `Pod::list` API has one required parameter (the namespace) and eight optional parameters. - -The clients of other languages use language features to allow the caller to not specify all these parameters when invoking the function. The Python client's functions parse optional parameters from `**kwargs`. The C# client's functions assign default values to these parameters in the function definition. - -Since Rust does not have such a feature, auto-generated Rust clients use `Option<>` parameters to represent optional parameters. This ends up requiring callers to pass in a lot of `None` parameters just to satisfy the compiler. Invoking the `Pod::list` of an auto-generated client would look like: - -```rust -// List all pods in the kube-system namespace -Pod::list("kube-system", None, None, None, None, None, None, None, None); - -// List all pods in the kube-system namespace with label foo=bar -Pod::list("kube-system", None, None, /* label_selector */ Some("foo=bar"), None, None, None, None, None); -``` - -Apart from being hard to read, you could easily make a typo and pass in `Some("foo=bar")` for one of the five other optional String parameters without any errors from the compiler. - -This crate moves all optional parameters to separate structs, one for each API. Each of these structs implements `Default` and the names of the fields match the function parameter names, so that the above calls look like: - -```rust -// List all pods in the kube-system namespace -Pod::list("kube-system", Default::default()); - -// List all pods in the kube-system namespace with label foo=bar -Pod::list("kube-system", ListOptional { label_selector: Some("foo=bar"), ..Default::default() }); -``` - -The second example uses struct update syntax to explicitly set one field of the struct and `Default` the rest. - - -### Not restricted to a single HTTP client implementation, and works with both synchronous and asynchronous HTTP clients - -Auto-generated clients have to choose between providing a synchronous or asynchronous API, and have to choose what kind of HTTP client they want to use internally (`hyper::Client`, `reqwest::Client`, `reqwest::blocking::Client`, etc). If you want to use a different HTTP client, you cannot use the crate. - -This crate is instead based on the [sans-io approach](https://sans-io.readthedocs.io/) popularized by Python for network protocols and applications. - -For example, the `Pod::list` function does not return `Result>` or `impl Future>`. It returns an `http::Request>` with the URL path, query string, request headers and request body filled out. You are free to execute this `http::Request` using any HTTP client you want to use. - -After you've executed the request, your HTTP client will give you the response's `http::StatusCode` and some `[u8]` bytes of the response body. To parse these into a `ListResponse`, you use that type's `fn try_from_parts(http::StatusCode, &[u8]) -> Result<(Self, usize), crate::ResponseError>` function. The result is either a successful `ListResponse` value, or an error that the response is incomplete and you need to get more bytes of the response body and try again, or a fatal error because the response is invalid JSON. - -To make this easier, the `Pod::list` function also returns a callback `fn(http::StatusCode) -> ResponseBody>`. `ResponseBody` is a type that contains its own internal growable byte buffer, so you can use it if you don't want to manage a byte buffer yourself. It also ensures that you deserialize the response to the appropriate type corresponding to the request, ie `ListResponse`, and not any other. See the crate docs for more details about this type. - - ### Supports more versions of Kubernetes Official clients tend to support only the three latest versions of Kubernetes. This crate supports a few more. diff --git a/ci/per_version.sh b/ci/per_version.sh index 969288e073..524211a0d6 100755 --- a/ci/per_version.sh +++ b/ci/per_version.sh @@ -6,31 +6,22 @@ set -euo pipefail export CARGO_TARGET_DIR="$PWD/target-tests-v$K8S_OPENAPI_ENABLED_VERSION" -for api_feature in 'yes' 'no'; do - case "$api_feature" in - 'yes') features_args='';; - 'no') features_args='--no-default-features';; - esac +echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:lib-tests ###" +RUST_BACKTRACE=full cargo test - echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:${api_feature}:lib-tests ###" - RUST_BACKTRACE=full cargo test $features_args +echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:clippy ###" +cargo clippy -- -D warnings - echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:${api_feature}:clippy ###" - cargo clippy $features_args -- -D warnings - - echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:${api_feature}:doc ###" - RUSTDOCFLAGS='-D warnings' cargo doc --no-deps $features_args -done +echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:doc ###" +RUSTDOCFLAGS='-D warnings' cargo doc --no-deps echo "### k8s-openapi:${K8S_OPENAPI_ENABLED_VERSION}:tests ###" RUST_BACKTRACE=full ./test.sh "$K8S_OPENAPI_ENABLED_VERSION" run-tests - echo '### k8s-openapi-tests:clippy ###' -test_version_feature_arg="--features test_v${K8S_OPENAPI_ENABLED_VERSION//./_}" pushd k8s-openapi-tests -cargo clippy --tests $test_version_feature_arg +cargo clippy --tests --features "test_v${K8S_OPENAPI_ENABLED_VERSION//./_}" popd pushd k8s-openapi-tests-macro-deps -cargo clippy --tests $test_version_feature_arg +cargo clippy --tests --features "test_v${K8S_OPENAPI_ENABLED_VERSION//./_}" popd diff --git a/k8s-openapi-codegen-common/src/lib.rs b/k8s-openapi-codegen-common/src/lib.rs index 1d7b861843..1fa79cf052 100644 --- a/k8s-openapi-codegen-common/src/lib.rs +++ b/k8s-openapi-codegen-common/src/lib.rs @@ -17,7 +17,6 @@ //! //! 1. Create a [`swagger20::Spec`] value, either by deserializing it from an OpenAPI spec JSON file or by creating it manually. //! 1. Invoke the [`run`] function for each definition in the spec. -//! 1. For each left-over API operations, ie those operations that weren't associated with any definition, invoke the [`write_operation`] function. pub mod swagger20; @@ -28,10 +27,9 @@ mod templates; pub struct RunResult { pub num_generated_structs: usize, pub num_generated_type_aliases: usize, - pub num_generated_apis: usize, } -/// Error type reported by [`run`] and [`write_operation`] +/// Error type reported by [`run`] #[derive(Debug)] pub struct Error(Box); @@ -91,24 +89,7 @@ pub trait RunState { /// /// - `parts`: A list of strings making up the components of the path of the generated type. Code generators that are emitting crates /// can use this parameter to make module subdirectories for each component, and to emit `use` statements in the final module's `mod.rs`. - /// - /// - `type_feature`: The name of the Rust feature that should be used to `cfg`-gate this type as a whole, if any. - /// Code generators that are emitting modules can use this flag to emit a `#[cfg(feature = "")]` on the `use` statement - /// for the generated type in the module's `mod.rs`. - fn make_writer( - &mut self, - parts: &[&str], - type_feature: Option<&str>, - ) -> std::io::Result; - - /// This function is invoked with the names of the optional parameters type and result type for each operation generated for a particular type. - /// - /// Code generators that are emitting modules can write out `use` lines in the module's `mod.rs` for each of these types. - fn handle_operation_types( - &mut self, - operation_optional_parameters_name: Option<&str>, - operation_result_name: Option<&str>, - ) -> std::io::Result<()>; + fn make_writer(&mut self, parts: &[&str]) -> std::io::Result; /// This function is invoked when `k8s_openapi_codegen_common::run` is done with the writer and completes successfully. /// The implementation can do any cleanup that it wants here. @@ -118,20 +99,8 @@ pub trait RunState { impl RunState for &'_ mut T where T: RunState { type Writer = ::Writer; - fn make_writer( - &mut self, - parts: &[&str], - type_feature: Option<&str>, - ) -> std::io::Result { - (*self).make_writer(parts, type_feature) - } - - fn handle_operation_types( - &mut self, - operation_optional_parameters_name: Option<&str>, - operation_result_name: Option<&str>, - ) -> std::io::Result<()> { - (*self).handle_operation_types(operation_optional_parameters_name, operation_result_name) + fn make_writer(&mut self, parts: &[&str]) -> std::io::Result { + (*self).make_writer(parts) } fn finish(&mut self, writer: Self::Writer) { @@ -150,14 +119,14 @@ pub enum GenerateSchema<'a> { No, } -/// Each invocation of this function generates a single type specified by the `definition_path` parameter along with its associated API operation functions. +/// Each invocation of this function generates a single type specified by the `definition_path` parameter. /// /// # Parameters /// /// - `definitions`: The definitions parsed from the OpenAPI spec that should be emitted as model types. /// -/// - `operations`: The list of operations parsed from the OpenAPI spec that should be emitted as API functions. -/// Note that this value will be mutated to remove the operations that are determined to be associated with the type currently being generated. +/// - `operations`: The list of operations parsed from the OpenAPI spec. The list is mutated to remove the operations +/// that are determined to be associated with the type currently being generated. /// /// - `definition_path`: The specific definition path out of the `definitions` collection that should be emitted. /// @@ -165,10 +134,6 @@ pub enum GenerateSchema<'a> { /// /// - `vis`: The visibility modifier that should be emitted on the generated code. /// -/// - `operation_feature`: If specified, all API functions will be emitted with a `#[cfg(feature = "")]` attribute. -/// The attribute will also be applied to their optional parameters and response types, if any, and to common types for -/// optional parameters and response types that are shared by multiple operations. -/// /// - `state`: See the documentation of the [`RunState`] trait. pub fn run( definitions: &std::collections::BTreeMap, @@ -177,11 +142,8 @@ pub fn run( map_namespace: &impl MapNamespace, vis: &str, generate_schema: GenerateSchema<'_>, - operation_feature: Option<&str>, mut state: impl RunState, ) -> Result { - use std::io::Write; - let definition = definitions.get(definition_path).ok_or_else(|| format!("definition for {definition_path} does not exist in spec"))?; let local = map_namespace_local_to_string(map_namespace)?; @@ -189,7 +151,6 @@ pub fn run( let mut run_result = RunResult { num_generated_structs: 0, num_generated_type_aliases: 0, - num_generated_apis: 0, }; let path_parts: Vec<_> = definition_path.split('.').collect(); @@ -198,28 +159,7 @@ pub fn run( .into_iter() .collect(); - let type_feature = - if let swagger20::SchemaKind::Ty( - swagger20::Type::CreateOptional(_) | - swagger20::Type::DeleteOptional(_) | - swagger20::Type::ListOptional(_) | - swagger20::Type::PatchOptional(_) | - swagger20::Type::ReplaceOptional(_) | - swagger20::Type::WatchOptional(_) | - swagger20::Type::CreateResponse | - swagger20::Type::DeleteResponse | - swagger20::Type::ListResponse | - swagger20::Type::PatchResponse | - swagger20::Type::ReplaceResponse | - swagger20::Type::WatchResponse - ) = &definition.kind { - operation_feature - } - else { - None - }; - - let mut out = state.make_writer(&namespace_parts, type_feature)?; + let mut out = state.make_writer(&namespace_parts)?; let type_name = path_parts.last().ok_or_else(|| format!("path for {definition_path} has no parts"))?; @@ -229,7 +169,6 @@ pub fn run( &mut out, definition_path, definition.description.as_deref(), - type_feature, derives, vis, )?; @@ -379,22 +318,7 @@ pub fn run( if let Some(mut operations) = operations_by_gkv.remove(&Some(kubernetes_group_kind_version.clone())) { operations.sort_by(|o1, o2| o1.id.cmp(&o2.id)); - writeln!(out)?; - writeln!(out, "// Begin {}/{}/{}", - kubernetes_group_kind_version.group, kubernetes_group_kind_version.version, kubernetes_group_kind_version.kind)?; - for operation in operations { - let (operation_optional_parameters_name, operation_result_name) = - write_operation( - &mut out, - &operation, - map_namespace, - vis, - Some(type_name), - operation_feature)?; - state.handle_operation_types(operation_optional_parameters_name.as_deref(), operation_result_name.as_deref())?; - run_result.num_generated_apis += 1; - // If this is a CRUD operation, use it to determine the resource's URL path segment and scope. match operation.kubernetes_action { Some( @@ -452,10 +376,6 @@ pub fn run( url_path_segment_and_scope.push((url_path_segment_, scope_)); } - - writeln!(out)?; - writeln!(out, "// End {}/{}/{}", - kubernetes_group_kind_version.group, kubernetes_group_kind_version.version, kubernetes_group_kind_version.kind)?; } } @@ -793,173 +713,6 @@ pub fn run( swagger20::SchemaKind::Ty(swagger20::Type::ListRef { .. }) => return Err(format!("definition {definition_path} is a ListRef").into()), - swagger20::SchemaKind::Ty(ty @ ( - swagger20::Type::CreateOptional(properties) | - swagger20::Type::DeleteOptional(properties) | - swagger20::Type::ListOptional(properties) | - swagger20::Type::PatchOptional(properties) | - swagger20::Type::ReplaceOptional(properties) | - swagger20::Type::WatchOptional(properties) - )) => { - let template_properties = { - let mut result = Vec::with_capacity(properties.len()); - - for (name, schema) in properties { - let field_name = get_rust_ident(name); - - let type_name = get_rust_borrow_type(&schema.kind, map_namespace)?; - - let field_type_name = - if let Some(borrowed_type_name) = type_name.strip_prefix('&') { - format!("Option<&'a {borrowed_type_name}>") - } - else { - format!("Option<{type_name}>") - }; - - result.push(templates::Property { - name, - comment: schema.description.as_deref(), - field_name, - field_type_name, - required: templates::PropertyRequired::Optional, - is_flattened: false, - merge_type: &schema.merge_type, - }); - } - - result - }; - - let template_generics = templates::Generics { - type_part: Some("'a"), - where_part: None, - }; - - templates::r#struct::generate( - &mut out, - vis, - type_name, - template_generics, - &template_properties, - )?; - - match ty { - swagger20::Type::CreateOptional(_) | - swagger20::Type::ListOptional(_) | - swagger20::Type::PatchOptional(_) | - swagger20::Type::ReplaceOptional(_) => - templates::query_string_optional::generate( - &mut out, - type_name, - template_generics, - vis, - &template_properties, - false, - operation_feature, - map_namespace, - )?, - - swagger20::Type::DeleteOptional(_) => - templates::impl_serialize::generate( - &mut out, - type_name, - template_generics, - &template_properties, - map_namespace, - None, - )?, - - swagger20::Type::WatchOptional(_) => - templates::query_string_optional::generate( - &mut out, - type_name, - template_generics, - vis, - &template_properties, - true, - operation_feature, - map_namespace, - )?, - - _ => unreachable!("unexpected optional params type"), - } - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::CreateResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::Create, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::DeleteResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::Delete, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::ListResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::List, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::PatchResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::Patch, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::ReplaceResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::Replace, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - - swagger20::SchemaKind::Ty(swagger20::Type::WatchResponse) => { - templates::operation_response_common::generate( - &mut out, - type_name, - map_namespace, - templates::operation_response_common::OperationAction::Watch, - operation_feature, - )?; - - run_result.num_generated_structs += 1; - }, - swagger20::SchemaKind::Ty(_) => { let inner_type_name = get_rust_type(&definition.kind, map_namespace)?; @@ -1078,14 +831,7 @@ fn get_derives( true, definitions, map_namespace, - |kind, _| Ok(!matches!(kind, swagger20::SchemaKind::Ty( - swagger20::Type::CreateResponse | - swagger20::Type::DeleteResponse | - swagger20::Type::ListResponse | - swagger20::Type::PatchResponse | - swagger20::Type::ReplaceResponse | - swagger20::Type::WatchResponse - ))))?; + |_, _| Ok(true))?; let derive_copy = derive_clone && @@ -1094,14 +840,7 @@ fn get_derives( false, definitions, map_namespace, - |kind, _| Ok(matches!(kind, swagger20::SchemaKind::Ty( - swagger20::Type::CreateOptional(_) | - swagger20::Type::DeleteOptional(_) | - swagger20::Type::ListOptional(_) | - swagger20::Type::PatchOptional(_) | - swagger20::Type::ReplaceOptional(_) | - swagger20::Type::WatchOptional(_) - ))))?; + |_, _| Ok(false))?; #[allow(clippy::match_same_arms)] let is_default = evaluate_trait_bound(kind, false, definitions, map_namespace, |kind, required| match kind { @@ -1126,13 +865,7 @@ fn get_derives( swagger20::SchemaKind::Ty( swagger20::Type::JsonSchemaPropsOr(_, _) | swagger20::Type::Patch | - swagger20::Type::WatchEvent(_) | - swagger20::Type::CreateResponse | - swagger20::Type::DeleteResponse | - swagger20::Type::ListResponse | - swagger20::Type::PatchResponse | - swagger20::Type::ReplaceResponse | - swagger20::Type::WatchResponse + swagger20::Type::WatchEvent(_) ) => Ok(false), _ => Ok(true), @@ -1148,14 +881,7 @@ fn get_derives( true, definitions, map_namespace, - |kind, _| Ok(!matches!(kind, swagger20::SchemaKind::Ty( - swagger20::Type::CreateResponse | - swagger20::Type::DeleteResponse | - swagger20::Type::ListResponse | - swagger20::Type::PatchResponse | - swagger20::Type::ReplaceResponse | - swagger20::Type::WatchResponse - ))))?; + |_, _| Ok(true))?; // The choice of deriving Eq, Ord and PartialOrd is deliberately more conservative than the choice of deriving PartialEq, // so as to not change dramatically between Kubernetes versions. For example, ObjectMeta is Ord in v1.15 but not in v1.16 because @@ -1215,13 +941,7 @@ fn is_default( swagger20::SchemaKind::Ty( swagger20::Type::JsonSchemaPropsOr(_, _) | swagger20::Type::Patch | - swagger20::Type::WatchEvent(_) | - swagger20::Type::CreateResponse | - swagger20::Type::DeleteResponse | - swagger20::Type::ListResponse | - swagger20::Type::PatchResponse | - swagger20::Type::ReplaceResponse | - swagger20::Type::WatchResponse + swagger20::Type::WatchEvent(_) ) => Ok(false), _ => Ok(true), @@ -1467,86 +1187,6 @@ pub fn get_rust_ident(name: &str) -> std::borrow::Cow<'static, str> { result.into() } -fn get_rust_borrow_type( - schema_kind: &swagger20::SchemaKind, - map_namespace: &impl MapNamespace, -) -> Result, Error> { - let local = map_namespace_local_to_string(map_namespace)?; - - #[allow(clippy::match_same_arms)] - match schema_kind { - swagger20::SchemaKind::Properties(_) => Err("Nested anonymous types not supported".into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.CreateOptional" => - Ok(format!("{local}CreateOptional<'_>").into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.DeleteOptional" => - Ok(format!("{local}DeleteOptional<'_>").into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.ListOptional" => - Ok(format!("{local}ListOptional<'_>").into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.PatchOptional" => - Ok(format!("{local}PatchOptional<'_>").into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.ReplaceOptional" => - Ok(format!("{local}ReplaceOptional<'_>").into()), - - swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) if path == "io.k8s.WatchOptional" => - Ok(format!("{local}WatchOptional<'_>").into()), - - swagger20::SchemaKind::Ref(ref_path) => - Ok(format!("&{}", get_fully_qualified_type_name(ref_path, map_namespace)).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Any) => Ok(format!("&{local}serde_json::Value").into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Array { items }) => - Ok(format!("&[{}]", get_rust_type(&items.kind, map_namespace)?).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Boolean) => Ok("bool".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Integer { format: swagger20::IntegerFormat::Int32 }) => Ok("i32".into()), - swagger20::SchemaKind::Ty(swagger20::Type::Integer { format: swagger20::IntegerFormat::Int64 }) => Ok("i64".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Number { format: swagger20::NumberFormat::Double }) => Ok("f64".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::Object { additional_properties }) => - Ok(format!("&std::collections::BTreeMap", get_rust_type(&additional_properties.kind, map_namespace)?).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::String { format: Some(swagger20::StringFormat::Byte) }) => - Ok(format!("&{}", get_rust_type(schema_kind, map_namespace)?).into()), - swagger20::SchemaKind::Ty(swagger20::Type::String { format: Some(swagger20::StringFormat::DateTime) }) => - Ok(format!("&{}", get_rust_type(schema_kind, map_namespace)?).into()), - swagger20::SchemaKind::Ty(swagger20::Type::String { format: None }) => Ok("&str".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::CustomResourceSubresources(_)) => - Ok(format!("&{}", get_rust_type(schema_kind, map_namespace)?).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::IntOrString) => Err("nothing should be trying to refer to IntOrString".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::JsonSchemaPropsOr(_, _)) => Err("JSON schema types not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::Patch) => Err("Patch type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::WatchEvent(_)) => Err("WatchEvent type not supported".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::ListDef { .. }) => Err("ListDef type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ListRef { .. }) => Ok(format!("&{}", get_rust_type(schema_kind, map_namespace)?).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::CreateOptional(_)) => Err("CreateOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::DeleteOptional(_)) => Err("DeleteOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ListOptional(_)) => Err("ListOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::PatchOptional(_)) => Err("PatchOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ReplaceOptional(_)) => Err("ReplaceOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::WatchOptional(_)) => Err("WatchOptional type not supported".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::CreateResponse) => Err("CreateResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::DeleteResponse) => Err("DeleteResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ListResponse) => Err("ListResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::PatchResponse) => Err("PatchResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ReplaceResponse) => Err("ReplaceResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::WatchResponse) => Err("WatchResponse type not supported".into()), - } -} - fn get_rust_type( schema_kind: &swagger20::SchemaKind, map_namespace: &impl MapNamespace, @@ -1605,744 +1245,5 @@ fn get_rust_type( swagger20::SchemaKind::Ty(swagger20::Type::ListDef { .. }) => Err("ListDef type not supported".into()), swagger20::SchemaKind::Ty(swagger20::Type::ListRef { items }) => Ok(format!("{local}List<{}>", get_rust_type(items, map_namespace)?).into()), - - swagger20::SchemaKind::Ty(swagger20::Type::CreateOptional(_)) => Err("CreateOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::DeleteOptional(_)) => Err("DeleteOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ListOptional(_)) => Err("ListOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::PatchOptional(_)) => Err("PatchOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ReplaceOptional(_)) => Err("ReplaceOptional type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::WatchOptional(_)) => Err("WatchOptional type not supported".into()), - - swagger20::SchemaKind::Ty(swagger20::Type::CreateResponse) => Err("CreateResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::DeleteResponse) => Err("DeleteResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ListResponse) => Err("ListResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::PatchResponse) => Err("PatchResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::ReplaceResponse) => Err("ReplaceResponse type not supported".into()), - swagger20::SchemaKind::Ty(swagger20::Type::WatchResponse) => Err("WatchResponse type not supported".into()), - } -} - -/// Each invocation of this function generates a single API operation function specified by the `operation` parameter. -/// -/// # Parameters -/// -/// - `out`: An impl of `std::io::Write` that the operation will be emitted to. -/// -/// - `operation`: The operation to be emitted. -/// -/// - `map_namespace`: An instance of the [`MapNamespace`] trait that controls how OpenAPI namespaces of the definitions are mapped to rust namespaces. -/// -/// - `vis`: The visibility modifier that should be emitted on the generated code. -/// -/// - `type_name`: The name of the type that this operation is associated with, if any. -/// -/// - `operation_feature`: Specifies whether the API function will be emitted with a `#[cfg(feature = "")]` attribute or not. -/// -/// # Returns -/// -/// A tuple of two optional strings: -/// -/// 1. The name of the optional parameters type associated with the operation, if any. -/// 1. The name of the response type associated with the operation, if any. -pub fn write_operation( - mut out: impl std::io::Write, - operation: &swagger20::Operation, - map_namespace: &impl MapNamespace, - vis: &str, - type_name: Option<&str>, - operation_feature: Option<&str>, -) -> Result<(Option, Option), Error> { - let local = map_namespace_local_to_string(map_namespace)?; - - writeln!(out)?; - - writeln!(out, "// Generated from operation {}", operation.id)?; - - let (operation_fn_name, operation_result_name, operation_optional_parameters_name) = - get_operation_names(operation, type_name)?; - - let indent = if type_name.is_some() { " " } else { "" }; - - writeln!(out)?; - - if let Some(type_name) = type_name { - writeln!(out, "impl {type_name} {{")?; } - - let mut previous_parameters: std::collections::HashSet<_> = Default::default(); - let parameters: Result, Error> = - operation.parameters.iter().map(std::ops::Deref::deref) - .map(|parameter| { - let mut parameter_name = get_rust_ident(¶meter.name); - while previous_parameters.contains(¶meter_name) { - parameter_name.to_mut().push('_'); - } - previous_parameters.insert(parameter_name.clone()); - - let parameter_type = match get_rust_borrow_type(¶meter.schema.kind, map_namespace) { - Ok(parameter_type) => parameter_type, - Err(err) => return Err(err), - }; - - Ok((parameter_name, parameter_type, parameter)) - }) - .collect(); - let mut parameters = parameters?; - - let delete_optional_parameter = - parameters.iter() - .position(|(_, _, parameter)| - if let swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) = ¶meter.schema.kind { - path == "io.k8s.DeleteOptional" - } - else { - false - }) - .map(|index| parameters.swap_remove(index)); - - let query_string_optional_parameter = - parameters.iter() - .position(|(_, _, parameter)| - if let swagger20::SchemaKind::Ref(swagger20::RefPath { path, .. }) = ¶meter.schema.kind { - path == "io.k8s.CreateOptional" || - path == "io.k8s.ListOptional" || - path == "io.k8s.PatchOptional" || - path == "io.k8s.ReplaceOptional" || - path == "io.k8s.WatchOptional" - } - else { - false - }) - .map(|index| parameters.swap_remove(index)); - - parameters.sort_by(|(_, _, parameter1), (_, _, parameter2)| { - (match (parameter1.location, parameter2.location) { - (location1, location2) if location1 == location2 => std::cmp::Ordering::Equal, - (swagger20::ParameterLocation::Path, _) | - (swagger20::ParameterLocation::Body, swagger20::ParameterLocation::Query) => std::cmp::Ordering::Less, - _ => std::cmp::Ordering::Greater, - }) - .then_with(|| parameter1.name.cmp(¶meter2.name)) - }); - let parameters = parameters; - let (required_parameters, optional_parameters): (Vec<_>, Vec<_>) = parameters.iter().partition(|(_, _, parameter)| parameter.required); - let any_optional_fields_have_lifetimes = optional_parameters.iter().any(|(_, parameter_type, _)| parameter_type.starts_with('&')); - - let mut need_empty_line = false; - - if let Some(description) = operation.description.as_ref() { - for line in get_comment_text(description, "") { - writeln!(out, "{indent}///{line}")?; - need_empty_line = true; - } - } - if let Some(operation_result_name) = &operation_result_name { - if need_empty_line { - writeln!(out, "{indent}///")?; - } - - writeln!(out, - "{indent}/// Use the returned [`{local}ResponseBody`]`<`[`{operation_result_name}`]`>` constructor, or [`{operation_result_name}`] directly, to parse the HTTP response.")?; - need_empty_line = true; - } - else { - let common_response_type_link = match operation.responses { - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::CreateResponse) => - Some(format!("[`{local}CreateResponse`]`")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::DeleteResponse) => match operation.kubernetes_action { - Some(swagger20::KubernetesAction::Delete) => - Some(format!("[`{local}DeleteResponse`]`")), - - Some(swagger20::KubernetesAction::DeleteCollection) => - Some(format!("[`{local}DeleteResponse`]`<`[`{local}List`]`>")), - - kubernetes_action => return Err(format!( - "operation {} has a DeleteResponse response but its action {kubernetes_action:?} is neither a Delete nor DeleteCollection action", - operation.id).into()), - }, - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ListResponse) => - Some(format!("[`{local}ListResponse`]`")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::PatchResponse) => - Some(format!("[`{local}PatchResponse`]`")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ReplaceResponse) => - Some(format!("[`{local}ReplaceResponse`]`")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::WatchResponse) => - Some(format!("[`{local}WatchResponse`]`")), - - _ => None, - }; - - if let Some(common_response_type_link) = common_response_type_link { - if need_empty_line { - writeln!(out, "{indent}///")?; - } - - writeln!(out, - "{indent}/// Use the returned [`{local}ResponseBody`]`<`{common_response_type_link}>` constructor, or {common_response_type_link}` directly, to parse the HTTP response.")?; - need_empty_line = true; - } - } - - if !parameters.is_empty() || delete_optional_parameter.is_some() || query_string_optional_parameter.is_some() { - if need_empty_line { - writeln!(out, "{indent}///")?; - } - - writeln!(out, "{indent}/// # Arguments")?; - for (parameter_name, _, parameter) in &required_parameters { - writeln!(out, "{indent}///")?; - writeln!(out, "{indent}/// * `{parameter_name}`")?; - if let Some(description) = parameter.schema.description.as_ref() { - writeln!(out, "{indent}///")?; - for line in get_comment_text(description, " ") { - writeln!(out, "{indent}///{line}")?; - } - } - } - if let Some((parameter_name, _, parameter)) = &delete_optional_parameter { - writeln!(out, "{indent}///")?; - writeln!(out, "{indent}/// * `{parameter_name}`")?; - if let Some(description) = parameter.schema.description.as_ref() { - writeln!(out, "{indent}///")?; - for line in get_comment_text(description, " ") { - writeln!(out, "{indent}///{line}")?; - } - } - } - if let Some((parameter_name, _, parameter)) = &query_string_optional_parameter { - writeln!(out, "{indent}///")?; - writeln!(out, "{indent}/// * `{parameter_name}`")?; - if let Some(description) = parameter.schema.description.as_ref() { - writeln!(out, "{indent}///")?; - for line in get_comment_text(description, " ") { - writeln!(out, "{indent}///{line}")?; - } - } - } - if !optional_parameters.is_empty() { - writeln!(out, "{indent}///")?; - writeln!(out, "{indent}/// * `optional`")?; - writeln!(out, "{indent}///")?; - writeln!(out, "{indent}/// Optional parameters. Use `Default::default()` to not pass any.")?; - } - } - - if let Some(operation_feature) = operation_feature { - writeln!(out, r#"{indent}#[cfg(feature = {operation_feature:?})]"#)?; - } - - writeln!(out, "{indent}{vis}fn {operation_fn_name}(")?; - for (parameter_name, parameter_type, _) in &required_parameters { - writeln!(out, "{indent} {parameter_name}: {parameter_type},")?; - } - if let Some((parameter_name, parameter_type, _)) = &delete_optional_parameter { - writeln!(out, "{indent} {parameter_name}: {parameter_type},")?; - } - if let Some((parameter_name, parameter_type, _)) = &query_string_optional_parameter { - writeln!(out, "{indent} {parameter_name}: {parameter_type},")?; - } - if !optional_parameters.is_empty() { - write!(out, "{indent} optional: {operation_optional_parameters_name}")?; - if any_optional_fields_have_lifetimes { - write!(out, "<'_>")?; - } - writeln!(out, ",")?; - } - if let Some(operation_result_name) = &operation_result_name { - writeln!(out, - "{indent}) -> Result<({local}http::Request>, fn({local}http::StatusCode) -> {local}ResponseBody<{operation_result_name}>), {local}RequestError> {{")?; - } - else { - let common_response_type = match operation.responses { - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::CreateResponse) => - Some(format!("{local}CreateResponse")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::DeleteResponse) => match operation.kubernetes_action { - Some(swagger20::KubernetesAction::Delete) => - Some(format!("{local}DeleteResponse")), - - Some(swagger20::KubernetesAction::DeleteCollection) => - Some(format!("{local}DeleteResponse<{local}List>")), - - kubernetes_action => return Err(format!( - "operation {} has a DeleteResponse response but its action {kubernetes_action:?} is neither a Delete nor DeleteCollection action", - operation.id).into()), - }, - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ListResponse) => - Some(format!("{local}ListResponse")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::PatchResponse) => - Some(format!("{local}PatchResponse")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ReplaceResponse) => - Some(format!("{local}ReplaceResponse")), - - crate::swagger20::OperationResponses::Common(crate::swagger20::Type::WatchResponse) => - Some(format!("{local}WatchResponse")), - - _ => None, - }; - - if let Some(common_response_type) = common_response_type { - writeln!(out, - "{indent}) -> Result<({local}http::Request>, fn({local}http::StatusCode) -> {local}ResponseBody<{common_response_type}>), {local}RequestError> {{")?; - } - else { - writeln!(out, "{indent}) -> Result<{local}http::Request>, {local}RequestError> {{")?; - } - } - - let have_path_parameters = parameters.iter().any(|(_, _, parameter)| parameter.location == swagger20::ParameterLocation::Path); - let have_query_parameters = - parameters.iter().any(|(_, _, parameter)| parameter.location == swagger20::ParameterLocation::Query) || - query_string_optional_parameter.is_some(); - - if !optional_parameters.is_empty() { - writeln!(out, "{indent} let {operation_optional_parameters_name} {{")?; - for (parameter_name, _, _) in &optional_parameters { - writeln!(out, "{indent} {parameter_name},")?; - } - - writeln!(out, "{indent} }} = optional;")?; - } - - if have_path_parameters { - write!(out, r#"{indent} let __url = format!("{}"#, operation.path)?; - if have_query_parameters { - write!(out, "?")?; - } - write!(out, r#"""#)?; - if !parameters.is_empty() { - writeln!(out, ",")?; - for (parameter_name, parameter_type, parameter) in ¶meters { - if parameter.location == swagger20::ParameterLocation::Path { - match parameter.schema.kind { - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => (), - _ => return Err(format!("parameter {parameter_name} is in the path but is a {parameter_type:?}").into()), - } - - writeln!( - out, - "{indent} {parameter_name} = {local}percent_encoding::percent_encode({parameter_name}.as_bytes(), {local}percent_encoding2::PATH_SEGMENT_ENCODE_SET),")?; - } - } - write!(out, "{indent} ")?; - } - writeln!(out, ");")?; - } - else { - write!(out, r#"{indent} let __url = "{}"#, operation.path)?; - if have_query_parameters { - write!(out, "?")?; - } - writeln!(out, r#"".to_owned();"#)?; - } - - if have_query_parameters { - writeln!(out, "{indent} let mut __query_pairs = {local}url::form_urlencoded::Serializer::new(__url);")?; - if let Some((parameter_name, _, _)) = &query_string_optional_parameter { - writeln!(out, "{indent} {parameter_name}.__serialize(&mut __query_pairs);")?; - } - else { - for (parameter_name, parameter_type, parameter) in ¶meters { - if parameter.location == swagger20::ParameterLocation::Query { - if parameter.required { - match ¶meter.schema.kind { - swagger20::SchemaKind::Ty(swagger20::Type::Array { items }) => match &items.kind { - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => { - writeln!(out, "{indent} for {parameter_name} in {parameter_name} {{")?; - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, {parameter_name});"#, parameter.name)?; - writeln!(out, "{indent} }}")?; - }, - - _ => return Err(format!("parameter {} is in the query string but is a {parameter_type:?}", parameter.name).into()), - }, - - swagger20::SchemaKind::Ty(swagger20::Type::Boolean) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, if {parameter_name} {{ "true" }} else {{ "false" }});"#, parameter.name)?, - - swagger20::SchemaKind::Ty(swagger20::Type::Integer { .. } | swagger20::Type::Number { .. }) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, &{parameter_name}.to_string());"#, parameter.name)?, - - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, &{parameter_name});"#, parameter.name)?, - - _ => return Err(format!("parameter {} is in the query string but is a {parameter_type:?}", parameter.name).into()), - } - } - else { - writeln!(out, "{indent} if let Some({parameter_name}) = {parameter_name} {{")?; - match ¶meter.schema.kind { - swagger20::SchemaKind::Ty(swagger20::Type::Array { items }) => match &items.kind { - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => { - writeln!(out, "{indent} for {parameter_name} in {parameter_name} {{")?; - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, {parameter_name});"#, parameter.name)?; - writeln!(out, "{indent} }}")?; - }, - - _ => return Err(format!("parameter {} is in the query string but is a {parameter_type:?}", parameter.name).into()), - }, - - swagger20::SchemaKind::Ty(swagger20::Type::Boolean) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, if {parameter_name} {{ "true" }} else {{ "false" }});"#, parameter.name)?, - - swagger20::SchemaKind::Ty(swagger20::Type::Integer { .. } | swagger20::Type::Number { .. }) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, &{parameter_name}.to_string());"#, parameter.name)?, - - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => - writeln!(out, r#"{indent} __query_pairs.append_pair({:?}, {parameter_name});"#, parameter.name)?, - - _ => return Err(format!("parameter {} is in the query string but is a {parameter_type:?}", parameter.name).into()), - } - writeln!(out, "{indent} }}")?; - } - } - } - } - writeln!(out, "{indent} let __url = __query_pairs.finish();")?; - } - writeln!(out)?; - - let method = match operation.method { - swagger20::Method::Delete => "delete", - swagger20::Method::Get => "get", - swagger20::Method::Patch => "patch", - swagger20::Method::Post => "post", - swagger20::Method::Put => "put", - }; - - writeln!(out, "{indent} let __request = {local}http::Request::{method}(__url);")?; - - write!(out, "{indent} let __body = ")?; - let body_parameter = - 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. - - 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)?; - 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, "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" - } - else { - false - }; - if is_patch { - let patch_type = get_rust_type(¶meter.schema.kind, map_namespace)?; - writeln!(out, - "{indent} let __request = __request.header({local}http::header::CONTENT_TYPE, {local}http::header::HeaderValue::from_static(match {parameter_name} {{")?; - writeln!(out, r#"{indent} {patch_type}::Json(_) => "application/json-patch+json","#)?; - writeln!(out, r#"{indent} {patch_type}::Merge(_) => "application/merge-patch+json","#)?; - writeln!(out, r#"{indent} {patch_type}::StrategicMerge(_) => "application/strategic-merge-patch+json","#)?; - writeln!(out, "{indent} }}));")?; - } - else { - writeln!(out, - r#"{indent} let __request = __request.header({local}http::header::CONTENT_TYPE, {local}http::header::HeaderValue::from_static("application/json"));"#)?; - } - } - - if operation_result_name.is_some() { - writeln!(out, "{indent} match __request.body(__body) {{")?; - writeln!(out, "{indent} Ok(request) => Ok((request, {local}ResponseBody::new)),")?; - writeln!(out, "{indent} Err(err) => Err({local}RequestError::Http(err)),")?; - writeln!(out, "{indent} }}")?; - } - else { - let is_common_response_type = match operation.responses { - crate::swagger20::OperationResponses::Common(_) => true, - crate::swagger20::OperationResponses::Map(_) => false, - }; - - if is_common_response_type { - writeln!(out, "{indent} match __request.body(__body) {{")?; - writeln!(out, "{indent} Ok(request) => Ok((request, {local}ResponseBody::new)),")?; - writeln!(out, "{indent} Err(err) => Err({local}RequestError::Http(err)),")?; - writeln!(out, "{indent} }}")?; - } - else { - writeln!(out, "{indent} __request.body(__body).map_err({local}RequestError::Http)")?; - } - } - writeln!(out, "{indent}}}")?; - - if type_name.is_some() { - writeln!(out, "}}")?; - } - - if !optional_parameters.is_empty() { - writeln!(out)?; - - if let Some(type_name) = type_name { - writeln!(out, "/// Optional parameters of [`{type_name}::{operation_fn_name}`]")?; - } - else { - writeln!(out, "/// Optional parameters of [`{operation_fn_name}`]")?; - } - - if let Some(operation_feature) = operation_feature { - writeln!(out, r#"#[cfg(feature = {operation_feature:?})]"#)?; - } - writeln!(out, "#[derive(Clone, Copy, Debug, Default)]")?; - write!(out, "{vis}struct {operation_optional_parameters_name}")?; - if any_optional_fields_have_lifetimes { - write!(out, "<'a>")?; - } - writeln!(out, " {{")?; - - for (parameter_name, parameter_type, parameter) in &optional_parameters { - if let Some(description) = parameter.schema.description.as_ref() { - for line in get_comment_text(description, "") { - writeln!(out, " ///{line}")?; - } - } - if let Some(borrowed_parameter_type) = parameter_type.strip_prefix('&') { - writeln!(out, " {vis}{parameter_name}: Option<&'a {borrowed_parameter_type}>,")?; - } - else { - writeln!(out, " {vis}{parameter_name}: Option<{parameter_type}>,")?; - } - } - - writeln!(out, "}}")?; - } - - if let swagger20::OperationResponses::Map(responses) = &operation.responses { - if let Some(operation_result_name) = &operation_result_name { - writeln!(out)?; - - if let Some(type_name) = type_name { - writeln!(out, - "/// Use `<{operation_result_name} as Response>::try_from_parts` to parse the HTTP response body of [`{type_name}::{operation_fn_name}`]")?; - } - else { - writeln!(out, - "/// Use `<{operation_result_name} as Response>::try_from_parts` to parse the HTTP response body of [`{operation_fn_name}`]")?; - } - - if let Some(operation_feature) = operation_feature { - writeln!(out, r#"#[cfg(feature = {operation_feature:?})]"#)?; - } - writeln!(out, "#[derive(Debug)]")?; - writeln!(out, "{vis}enum {operation_result_name} {{")?; - - let operation_responses: Result, _> = - responses.iter() - .map(|(&status_code, schema)| { - let http_status_code = match status_code { - http::StatusCode::ACCEPTED => "ACCEPTED", - http::StatusCode::CREATED => "CREATED", - http::StatusCode::OK => "OK", - http::StatusCode::UNAUTHORIZED => "UNAUTHORIZED", - http::StatusCode::UNPROCESSABLE_ENTITY => "UNPROCESSABLE_ENTITY", - _ => return Err(format!("unrecognized status code {status_code}")), - }; - - let variant_name = match status_code { - http::StatusCode::ACCEPTED => "Accepted", - http::StatusCode::CREATED => "Created", - http::StatusCode::OK => "Ok", - http::StatusCode::UNAUTHORIZED => "Unauthorized", - http::StatusCode::UNPROCESSABLE_ENTITY => "UnprocessableEntity", - _ => return Err(format!("unrecognized status code {status_code}")), - }; - - Ok((http_status_code, variant_name, schema)) - }) - .collect(); - let operation_responses = operation_responses?; - - for &(_, variant_name, schema) in &operation_responses { - writeln!(out, " {variant_name}({}),", get_rust_type(&schema.kind, map_namespace)?)?; - } - - writeln!(out, " Other(Result, {local}serde_json::Error>),")?; - writeln!(out, "}}")?; - writeln!(out)?; - - if let Some(operation_feature) = operation_feature { - writeln!(out, r#"#[cfg(feature = {operation_feature:?})]"#)?; - } - writeln!(out, "impl {local}Response for {operation_result_name} {{")?; - writeln!(out, " fn try_from_parts(status_code: {local}http::StatusCode, buf: &[u8]) -> Result<(Self, usize), {local}ResponseError> {{")?; - - writeln!(out, " match status_code {{")?; - for &(http_status_code, variant_name, schema) in &operation_responses { - writeln!(out, " {local}http::StatusCode::{http_status_code} => {{")?; - - match &schema.kind { - swagger20::SchemaKind::Ty(swagger20::Type::String { .. }) => { - writeln!(out, " if buf.is_empty() {{")?; - writeln!(out, " return Err({local}ResponseError::NeedMoreData);")?; - writeln!(out, " }}")?; - writeln!(out)?; - writeln!(out, " let (result, len) = match std::str::from_utf8(buf) {{")?; - writeln!(out, " Ok(s) => (s, buf.len()),")?; - writeln!(out, " Err(err) => match (err.valid_up_to(), err.error_len()) {{")?; - writeln!(out, " (0, Some(_)) => return Err({local}ResponseError::Utf8(err)),")?; - writeln!(out, " (0, None) => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(out, " (valid_up_to, _) => (")?; - writeln!(out, " unsafe {{ std::str::from_utf8_unchecked(buf.get_unchecked(..valid_up_to)) }},")?; - writeln!(out, " valid_up_to,")?; - writeln!(out, " ),")?; - writeln!(out, " }},")?; - writeln!(out, " }};")?; - writeln!(out, " Ok(({operation_result_name}::{variant_name}(result.to_owned()), len))")?; - }, - - swagger20::SchemaKind::Ref(_) => { - writeln!(out, " let result = match {local}serde_json::from_slice(buf) {{")?; - writeln!(out, " Ok(value) => value,")?; - writeln!(out, " Err(err) if err.is_eof() => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(out, " Err(err) => return Err({local}ResponseError::Json(err)),")?; - writeln!(out, " }};")?; - writeln!(out, " Ok(({operation_result_name}::{variant_name}(result), buf.len()))")?; - }, - - other => return Err(format!("operation {} has unrecognized type for response of variant {variant_name}: {other:?}", operation.id).into()), - } - - writeln!(out, " }},")?; - } - writeln!(out, " _ => {{")?; - writeln!(out, " let (result, read) =")?; - writeln!(out, " if buf.is_empty() {{")?; - writeln!(out, " (Ok(None), 0)")?; - writeln!(out, " }}")?; - writeln!(out, " else {{")?; - writeln!(out, " match {local}serde_json::from_slice(buf) {{")?; - writeln!(out, " Ok(value) => (Ok(Some(value)), buf.len()),")?; - writeln!(out, " Err(err) if err.is_eof() => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(out, " Err(err) => (Err(err), 0),")?; - writeln!(out, " }}")?; - writeln!(out, " }};")?; - writeln!(out, " Ok(({operation_result_name}::Other(result), read))")?; - writeln!(out, " }},")?; - writeln!(out, " }}")?; - writeln!(out, " }}")?; - writeln!(out, "}}")?; - } - } - - let mut result = (None, operation_result_name); - if type_name.is_some() && !optional_parameters.is_empty() { - result.0 = Some(operation_optional_parameters_name); - } - Ok(result) -} - -fn get_operation_names( - operation: &swagger20::Operation, - type_name: Option<&str>, -) -> Result<(std::borrow::Cow<'static, str>, Option, String), Error> { - let (operation_id, operation_id_with_type_name) = - if let Some(type_name) = type_name { - // For operations associated with types, like `listCoreV1NamespacedPod`, - // the best function name is `Pod::list`, because: - // - // 1. The type name can be stripped, leading to `listCoreV1Namespaced` - // 2. The `Namespaced` part can be stripped, leading to `listCoreV1` - // 3. The API version contained in the operation name can be stripped, leading to `list`. - // The operation tag is this value. - // - // However the type name is retained for computing the result type name and optional parameters type name, - // since otherwise any mod with multiple types will end up having types of the same name, eg multiple `ReadResponse`s. - - let tag: String = { - // `operation.tag` is empty for `#[derive(k8s_openapi_derive::CustomResourceDefinition)]` - let tag = operation.tag.as_deref().unwrap_or(""); - tag.split('_') - .map(|part| { - let mut chars = part.chars(); - if let Some(first_char) = chars.next() { - let rest_chars = chars.as_str(); - std::borrow::Cow::Owned(format!("{}{rest_chars}", first_char.to_uppercase())) - } - else { - std::borrow::Cow::Borrowed("") - } - }) - .collect() - }; - - if let Some(operation_id) = operation.id.strip_suffix(type_name) { - let operation_id = operation_id.replacen("Namespaced", "", 1); - let operation_id = operation_id.replacen(&tag, "", 1); - let operation_id_with_type_name = format!("{operation_id}{type_name}"); - (std::borrow::Cow::Owned(operation_id), std::borrow::Cow::Owned(operation_id_with_type_name)) - } - else { - // Type name is in the middle of the operation ID, eg `patchCoreV1NamespacedPodStatus` - // In this case, `replacen(1)` the type name instead of `strip_suffix()`ing it, and retain the original string - // as the `operation_id_with_type_name`. - - let operation_id_with_type_name = operation.id.replacen("Namespaced", "", 1); - let operation_id_with_type_name = operation_id_with_type_name.replacen(&tag, "", 1); - let operation_id = operation_id_with_type_name.replacen(type_name, "", 1); - (std::borrow::Cow::Owned(operation_id), std::borrow::Cow::Owned(operation_id_with_type_name)) - } - } - else { - // Functions not associated with types (eg `::get_core_v1_api_resources`) get emitted at the mod root, - // so their ID should be used as-is. - (std::borrow::Cow::Borrowed(&*operation.id), std::borrow::Cow::Borrowed(&*operation.id)) - }; - - let operation_fn_name = get_rust_ident(&operation_id); - - let mut chars = operation_id_with_type_name.chars(); - let first_char = chars.next().ok_or_else(|| format!("operation has empty ID: {operation:?}"))?.to_uppercase(); - let rest_chars = chars.as_str(); - let operation_result_name = match (&operation.responses, operation.kubernetes_action) { - (swagger20::OperationResponses::Common(_), _) | - (_, Some(swagger20::KubernetesAction::Connect)) => None, - _ => Some(format!("{first_char}{rest_chars}Response")), - }; - let operation_optional_parameters_name = format!("{first_char}{rest_chars}Optional"); - - Ok((operation_fn_name, operation_result_name, operation_optional_parameters_name)) } diff --git a/k8s-openapi-codegen-common/src/swagger20/definitions.rs b/k8s-openapi-codegen-common/src/swagger20/definitions.rs index f2aea175e3..80ef96b552 100644 --- a/k8s-openapi-codegen-common/src/swagger20/definitions.rs +++ b/k8s-openapi-codegen-common/src/swagger20/definitions.rs @@ -315,22 +315,6 @@ pub enum Type { // Special type for lists ListDef { metadata: Box }, // The definition of the List type ListRef { items: Box }, // A reference to a specialization of the List type for a particular resource type, eg List for PodList - - // Special types for common parameters of some API operations - CreateOptional(std::collections::BTreeMap), - DeleteOptional(std::collections::BTreeMap), - ListOptional(std::collections::BTreeMap), - PatchOptional(std::collections::BTreeMap), - ReplaceOptional(std::collections::BTreeMap), - WatchOptional(std::collections::BTreeMap), - - // Special types for responses of some API operations - CreateResponse, - DeleteResponse, - ListResponse, - PatchResponse, - ReplaceResponse, - WatchResponse, } #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] diff --git a/k8s-openapi-codegen-common/src/swagger20/mod.rs b/k8s-openapi-codegen-common/src/swagger20/mod.rs index 77ab339870..0aa735cb98 100644 --- a/k8s-openapi-codegen-common/src/swagger20/mod.rs +++ b/k8s-openapi-codegen-common/src/swagger20/mod.rs @@ -46,10 +46,10 @@ impl<'de> serde::Deserialize<'de> for Spec { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de> { #[derive(Debug, serde::Deserialize)] pub struct InnerSpec { - swagger: String, info: Info, definitions: std::collections::BTreeMap, paths: std::collections::BTreeMap, + swagger: String, } #[derive(Debug, serde::Deserialize)] @@ -59,77 +59,16 @@ impl<'de> serde::Deserialize<'de> for Spec { patch: Option, post: Option, put: Option, - #[serde(default)] - parameters: Vec>, } #[derive(Debug, serde::Deserialize)] struct InnerOperation { - description: Option, #[serde(rename = "operationId")] id: String, #[serde(rename = "x-kubernetes-action")] kubernetes_action: Option, #[serde(rename = "x-kubernetes-group-version-kind")] kubernetes_group_kind_version: Option, - #[serde(default)] - parameters: Vec>, - responses: std::collections::BTreeMap, - tags: Option<(String,)>, - } - - #[derive(Debug, serde::Deserialize)] - struct InnerResponse { - schema: Option, - } - - fn parse_operation<'de, D>( - value: InnerOperation, - method: Method, - path: Path, - mut parameters: Vec>, - ) -> Result where D: serde::Deserializer<'de> { - let responses: Result<_, _> = - value.responses.into_iter() - .filter_map(|(status_code_str, response)| { - let Ok(status_code) = status_code_str.parse() else { - return Some(Err(serde::de::Error::invalid_value( - serde::de::Unexpected::Str(&status_code_str), - &"string representation of an HTTP status code"))); - }; - let schema = response.schema?; - Some(Ok((status_code, schema))) - }) - .collect(); - - for parameter in value.parameters { - if let Some(p) = parameters.iter_mut().find(|p| p.name == parameter.name) { - *p = parameter; - } - else { - parameters.push(parameter); - } - } - - if method == Method::Get { - for parameter in ¶meters { - if parameter.location == ParameterLocation::Body { - return Err(serde::de::Error::custom(format!("Operation {} has method GET but has a body parameter {}", value.id, parameter.name))); - } - } - } - - Ok(Operation { - description: value.description, - id: value.id, - path, - kubernetes_action: value.kubernetes_action, - kubernetes_group_kind_version: value.kubernetes_group_kind_version, - method, - parameters, - responses: OperationResponses::Map(responses?), - tag: value.tags.map(|t|t.0), - }) } let result: InnerSpec = serde::Deserialize::deserialize(deserializer)?; @@ -142,23 +81,48 @@ impl<'de> serde::Deserialize<'de> for Spec { for (path, path_item) in result.paths { if let Some(delete) = path_item.delete { - operations.push(parse_operation::(delete, Method::Delete, path.clone(), path_item.parameters.clone())?); + operations.push(Operation { + id: delete.id, + kubernetes_action: delete.kubernetes_action, + kubernetes_group_kind_version: delete.kubernetes_group_kind_version, + path: path.clone(), + }); } if let Some(get) = path_item.get { - operations.push(parse_operation::(get, Method::Get, path.clone(), path_item.parameters.clone())?); + operations.push(Operation { + id: get.id, + kubernetes_action: get.kubernetes_action, + kubernetes_group_kind_version: get.kubernetes_group_kind_version, + path: path.clone(), + }); } if let Some(patch) = path_item.patch { - operations.push(parse_operation::(patch, Method::Patch, path.clone(), path_item.parameters.clone())?); + operations.push(Operation { + id: patch.id, + kubernetes_action: patch.kubernetes_action, + kubernetes_group_kind_version: patch.kubernetes_group_kind_version, + path: path.clone(), + }); } if let Some(post) = path_item.post { - operations.push(parse_operation::(post, Method::Post, path.clone(), path_item.parameters.clone())?); + operations.push(Operation { + id: post.id, + kubernetes_action: post.kubernetes_action, + kubernetes_group_kind_version: post.kubernetes_group_kind_version, + path: path.clone(), + }); } if let Some(put) = path_item.put { - operations.push(parse_operation::(put, Method::Put, path, path_item.parameters)?); + operations.push(Operation { + id: put.id, + kubernetes_action: put.kubernetes_action, + kubernetes_group_kind_version: put.kubernetes_group_kind_version, + path, + }); } } diff --git a/k8s-openapi-codegen-common/src/swagger20/paths.rs b/k8s-openapi-codegen-common/src/swagger20/paths.rs index 7abba02d68..59eaad6f77 100644 --- a/k8s-openapi-codegen-common/src/swagger20/paths.rs +++ b/k8s-openapi-codegen-common/src/swagger20/paths.rs @@ -49,124 +49,13 @@ impl<'de> serde::Deserialize<'de> for KubernetesAction { } } -/// The HTTP method of an API operation. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum Method { - Delete, - Get, - Patch, - Post, - Put, -} - /// An API operation. #[derive(Clone, Debug)] pub struct Operation { - pub description: Option, pub id: String, - pub method: Method, pub kubernetes_action: Option, pub kubernetes_group_kind_version: Option, - pub parameters: Vec>, pub path: Path, - pub responses: OperationResponses, - pub tag: Option, -} - -/// The type of all possible responses of an API operation. -#[derive(Clone, Debug)] -pub enum OperationResponses { - /// The responses of this operation are represented by a common type that is shared by other operations. - Common(super::Type), - - /// The responses of this operation are uniquely identified by this map of HTTP status codes to schemas. - Map(std::collections::BTreeMap), -} - -/// An API operation parameter. -#[derive(Clone, Debug)] -pub struct Parameter { - pub location: ParameterLocation, - pub name: String, - pub required: bool, - pub schema: super::Schema, -} - -#[cfg(feature = "serde")] -#[allow(clippy::use_self)] -impl<'de> serde::Deserialize<'de> for Parameter { - fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de> { - #[derive(Debug, serde::Deserialize)] - struct InnerParameter { - description: Option, - #[serde(rename = "in")] - location: String, - name: String, - required: Option, - #[serde(rename = "type")] - ty: Option, - schema: Option, - } - - let value: InnerParameter = serde::Deserialize::deserialize(deserializer)?; - - let (location, schema) = match (&*value.location, value.ty, value.schema) { - ("body", None, Some(schema)) => ( - ParameterLocation::Body, - super::Schema { - description: value.description, - ..schema - }, - ), - - ("path", Some(ty), None) => ( - ParameterLocation::Path, - super::Schema { - description: value.description, - kind: super::SchemaKind::Ty(super::Type::parse::(&ty, None, None, None)?), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - ), - - ("query", Some(ty), None) => ( - ParameterLocation::Query, - super::Schema { - description: value.description, - kind: super::SchemaKind::Ty(super::Type::parse::(&ty, None, None, None)?), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - ), - - _ => return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value.location), &"a parameter location")), - }; - - let required = match (value.required, location) { - (_, ParameterLocation::Path) => true, - (Some(required), _) => required, - (None, _) => false, - }; - - Ok(Parameter { - location, - name: value.name, - required, - schema, - }) - } -} - -/// The location of an API operation parameter in the HTTP request. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum ParameterLocation { - Body, - Path, - Query, } /// The path of an API operation. diff --git a/k8s-openapi-codegen-common/src/templates/mod.rs b/k8s-openapi-codegen-common/src/templates/mod.rs index c6ea1b3c0f..491d543b91 100644 --- a/k8s-openapi-codegen-common/src/templates/mod.rs +++ b/k8s-openapi-codegen-common/src/templates/mod.rs @@ -16,12 +16,8 @@ pub(crate) mod json_schema_props_or; pub(crate) mod newtype; -pub(crate) mod operation_response_common; - pub(crate) mod patch; -pub(crate) mod query_string_optional; - pub(crate) mod r#struct; pub(crate) mod struct_deep_merge; diff --git a/k8s-openapi-codegen-common/src/templates/operation_response_common.rs b/k8s-openapi-codegen-common/src/templates/operation_response_common.rs deleted file mode 100644 index 83d3b5e668..0000000000 --- a/k8s-openapi-codegen-common/src/templates/operation_response_common.rs +++ /dev/null @@ -1,171 +0,0 @@ -pub(crate) fn generate( - mut writer: impl std::io::Write, - type_name: &str, - map_namespace: &impl crate::MapNamespace, - operation_action: OperationAction, - operation_feature: Option<&str>, -) -> Result<(), crate::Error> { - let local = crate::map_namespace_local_to_string(map_namespace)?; - let metav1 = { - let namespace_parts = - map_namespace.map_namespace(&["io", "k8s", "apimachinery", "pkg", "apis", "meta", "v1"]) - .ok_or(r#"unexpected path "io.k8s.apimachinery.pkg.apis.meta.v1""#)?; - let mut result = String::new(); - for namespace_part in namespace_parts { - result.push_str(&crate::get_rust_ident(namespace_part)); - result.push_str("::"); - } - result - }; - - let type_generics_impl = ""; - let type_generics_type = ""; - let type_generics_where = match operation_action { - OperationAction::Create | - OperationAction::Delete | - OperationAction::Replace | - OperationAction::Patch | - OperationAction::Watch => format!(" where T: {local}serde::de::DeserializeOwned"), - OperationAction::List => format!(" where T: {local}serde::de::DeserializeOwned + {local}ListableResource"), - }; - - let operation_feature_attribute: std::borrow::Cow<'static, str> = - operation_feature.map_or("".into(), |operation_feature| format!("#[cfg(feature = {operation_feature:?})]\n").into()); - - let mut variants = String::new(); - let mut variant_match_arms = String::new(); - match operation_action { - OperationAction::Create => { - use std::fmt::Write; - - writeln!(variants, " Ok(T),")?; - writeln!(variants, " Created(T),")?; - writeln!(variants, " Accepted(T),")?; - - variant_match_arms.push_str(&deserialize_single(&local, "OK", type_name, "Ok")?); - variant_match_arms.push_str(&deserialize_single(&local, "CREATED", type_name, "Created")?); - variant_match_arms.push_str(&deserialize_single(&local, "ACCEPTED", type_name, "Accepted")?); - }, - - OperationAction::Delete => { - use std::fmt::Write; - - // Delete and delete-collection operations that return metav1.Status for HTTP 200 can also return the object itself instead. - // - // In case of delete-collection operations, this is the list object corresponding to the associated type. - // - // Ref https://github.com/kubernetes/kubernetes/issues/59501 - - writeln!(variants, " OkStatus({metav1}Status),")?; - writeln!(variants, " OkValue(T),")?; - writeln!(variants, " Accepted(T),")?; - - writeln!(variant_match_arms, " http::StatusCode::OK => {{")?; - writeln!(variant_match_arms, " let result: {local}serde_json::Map = match {local}serde_json::from_slice(buf) {{")?; - writeln!(variant_match_arms, " Ok(value) => value,")?; - writeln!(variant_match_arms, " Err(err) if err.is_eof() => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(variant_match_arms, " Err(err) => return Err({local}ResponseError::Json(err)),")?; - writeln!(variant_match_arms, " }};")?; - writeln!(variant_match_arms, r#" let is_status = matches!(result.get("kind"), Some({local}serde_json::Value::String(s)) if s == "Status");"#)?; - writeln!(variant_match_arms, " if is_status {{")?; - writeln!(variant_match_arms, " let result = {local}serde::Deserialize::deserialize({local}serde_json::Value::Object(result));")?; - writeln!(variant_match_arms, " let result = result.map_err({local}ResponseError::Json)?;")?; - writeln!(variant_match_arms, " Ok(({type_name}::OkStatus(result), buf.len()))")?; - writeln!(variant_match_arms, " }}")?; - writeln!(variant_match_arms, " else {{")?; - writeln!(variant_match_arms, " let result = {local}serde::Deserialize::deserialize({local}serde_json::Value::Object(result));")?; - writeln!(variant_match_arms, " let result = result.map_err({local}ResponseError::Json)?;")?; - writeln!(variant_match_arms, " Ok(({type_name}::OkValue(result), buf.len()))")?; - writeln!(variant_match_arms, " }}")?; - writeln!(variant_match_arms, " }},")?; - variant_match_arms.push_str(&deserialize_single(&local, "ACCEPTED", type_name, "Accepted")?); - }, - - OperationAction::List => { - use std::fmt::Write; - - writeln!(variants, " Ok({local}List),")?; - - variant_match_arms.push_str(&deserialize_single(&local, "OK", type_name, "Ok")?); - }, - - OperationAction::Patch => { - use std::fmt::Write; - - writeln!(variants, " Ok(T),")?; - writeln!(variants, " Created(T),")?; - - variant_match_arms.push_str(&deserialize_single(&local, "OK", type_name, "Ok")?); - variant_match_arms.push_str(&deserialize_single(&local, "CREATED", type_name, "Created")?); - }, - - OperationAction::Replace => { - use std::fmt::Write; - - writeln!(variants, " Ok(T),")?; - writeln!(variants, " Created(T),")?; - - variant_match_arms.push_str(&deserialize_single(&local, "OK", type_name, "Ok")?); - variant_match_arms.push_str(&deserialize_single(&local, "CREATED", type_name, "Created")?); - }, - - OperationAction::Watch => { - use std::fmt::Write; - - writeln!(variants, " Ok({metav1}WatchEvent),")?; - - writeln!(variant_match_arms, " http::StatusCode::OK => {{")?; - writeln!(variant_match_arms, " let mut deserializer = {local}serde_json::Deserializer::from_slice(buf).into_iter();")?; - writeln!(variant_match_arms, " let (result, byte_offset) = match deserializer.next() {{")?; - writeln!(variant_match_arms, " Some(Ok(value)) => (value, deserializer.byte_offset()),")?; - writeln!(variant_match_arms, " Some(Err(err)) if err.is_eof() => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(variant_match_arms, " Some(Err(err)) => return Err({local}ResponseError::Json(err)),")?; - writeln!(variant_match_arms, " None => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(variant_match_arms, " }};")?; - writeln!(variant_match_arms, " Ok(({type_name}::Ok(result), byte_offset))")?; - writeln!(variant_match_arms, " }},")?; - }, - }; - - writeln!( - writer, - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/templates/operation_response_common.rs")), - local = local, - type_name = type_name, - type_generics_impl = type_generics_impl, - type_generics_type = type_generics_type, - type_generics_where = type_generics_where, - variants = variants, - operation_feature_attribute = operation_feature_attribute, - variant_match_arms = variant_match_arms, - )?; - - Ok(()) -} - -fn deserialize_single(local: &str, status_code: &str, type_name: &str, variant_name: &str) -> Result { - use std::fmt::Write; - - let mut result = String::new(); - - writeln!(result, " http::StatusCode::{status_code} => {{")?; - writeln!(result, " let result = match {local}serde_json::from_slice(buf) {{")?; - writeln!(result, " Ok(value) => value,")?; - writeln!(result, " Err(err) if err.is_eof() => return Err({local}ResponseError::NeedMoreData),")?; - writeln!(result, " Err(err) => return Err({local}ResponseError::Json(err)),")?; - writeln!(result, " }};")?; - writeln!(result, " Ok(({type_name}::{variant_name}(result), buf.len()))")?; - writeln!(result, " }},")?; - - Ok(result) -} - -#[derive(Clone, Copy)] -pub(crate) enum OperationAction { - Create, - Delete, - List, - Patch, - Replace, - Watch, -} diff --git a/k8s-openapi-codegen-common/src/templates/query_string_optional.rs b/k8s-openapi-codegen-common/src/templates/query_string_optional.rs deleted file mode 100644 index a8f772b87b..0000000000 --- a/k8s-openapi-codegen-common/src/templates/query_string_optional.rs +++ /dev/null @@ -1,57 +0,0 @@ -pub(crate) fn generate( - mut writer: impl std::io::Write, - type_name: &str, - generics: super::Generics<'_>, - vis: &str, - fields: &[super::Property<'_>], - is_watch: bool, - operation_feature: Option<&str>, - map_namespace: &impl crate::MapNamespace, -) -> Result<(), crate::Error> { - let local = crate::map_namespace_local_to_string(map_namespace)?; - - let type_generics_impl = generics.type_part.map(|part| format!("<{part}>")).unwrap_or_default(); - let type_generics_type = generics.type_part.map(|part| format!("<{part}>")).unwrap_or_default(); - let type_generics_where = generics.where_part.map(|part| format!(" where {part}")).unwrap_or_default(); - - let operation_feature_attribute: std::borrow::Cow<'static, str> = - operation_feature.map_or("".into(), |operation_feature| format!("#[cfg(feature = {operation_feature:?})]\n").into()); - - let mut fields_append_pair = String::new(); - - for super::Property { name, field_name, field_type_name, .. } in fields { - use std::fmt::Write; - - writeln!(fields_append_pair, " if let Some(value) = self.{field_name} {{")?; - match &**field_type_name { - "Option<&'a str>" => writeln!(fields_append_pair, r#" __query_pairs.append_pair({name:?}, value);"#)?, - "Option" => writeln!(fields_append_pair, r#" __query_pairs.append_pair({name:?}, if value {{ "true" }} else {{ "false" }});"#)?, - _ => writeln!(fields_append_pair, r#" __query_pairs.append_pair({name:?}, &value.to_string());"#)?, - } - writeln!(fields_append_pair, " }}")?; - } - - let watch_append_pair = - if is_watch { - " __query_pairs.append_pair(\"watch\", \"true\");\n" - } - else { - "" - }; - - writeln!( - writer, - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/templates/query_string_optional.rs")), - local = local, - type_name = type_name, - type_generics_impl = type_generics_impl, - type_generics_type = type_generics_type, - type_generics_where = type_generics_where, - operation_feature_attribute = operation_feature_attribute, - vis = vis, - fields_append_pair = fields_append_pair, - watch_append_pair = watch_append_pair, - )?; - - Ok(()) -} diff --git a/k8s-openapi-codegen-common/src/templates/type_header.rs b/k8s-openapi-codegen-common/src/templates/type_header.rs index 40c6c6f4f4..aa6650271e 100644 --- a/k8s-openapi-codegen-common/src/templates/type_header.rs +++ b/k8s-openapi-codegen-common/src/templates/type_header.rs @@ -2,7 +2,6 @@ pub(crate) fn generate( mut writer: impl std::io::Write, definition_path: &crate::swagger20::DefinitionPath, type_comment: Option<&str>, - type_feature: Option<&str>, derives: Option, vis: &str, ) -> Result<(), crate::Error> { @@ -16,11 +15,6 @@ pub(crate) fn generate( })) .unwrap_or_default(); - let type_feature_attribute = - type_feature - .map(|type_feature| format!("#[cfg(feature = {type_feature:?})]\n")) - .unwrap_or_default(); - let derives = derives .map(|Derives { clone, copy, default, eq, ord, partial_eq, partial_ord }| format!( @@ -40,7 +34,6 @@ pub(crate) fn generate( include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/templates/type_header.rs")), definition_path = definition_path, type_comment = type_comment, - type_feature_attribute = type_feature_attribute, derives = derives, vis = vis, )?; diff --git a/k8s-openapi-codegen-common/templates/operation_response_common.rs b/k8s-openapi-codegen-common/templates/operation_response_common.rs deleted file mode 100644 index f5e21cd54e..0000000000 --- a/k8s-openapi-codegen-common/templates/operation_response_common.rs +++ /dev/null @@ -1,24 +0,0 @@ -enum {type_name}{type_generics_type}{type_generics_where} {{ -{variants} Other(Result, {local}serde_json::Error>), -}} - -{operation_feature_attribute}impl{type_generics_impl} {local}Response for {type_name}{type_generics_type}{type_generics_where} {{ - fn try_from_parts(status_code: {local}http::StatusCode, buf: &[u8]) -> Result<(Self, usize), {local}ResponseError> {{ - match status_code {{ -{variant_match_arms} _ => {{ - let (result, read) = - if buf.is_empty() {{ - (Ok(None), 0) - }} - else {{ - match {local}serde_json::from_slice(buf) {{ - Ok(value) => (Ok(Some(value)), buf.len()), - Err(err) if err.is_eof() => return Err({local}ResponseError::NeedMoreData), - Err(err) => (Err(err), 0), - }} - }}; - Ok(({type_name}::Other(result), read)) - }}, - }} - }} -}} \ No newline at end of file diff --git a/k8s-openapi-codegen-common/templates/query_string_optional.rs b/k8s-openapi-codegen-common/templates/query_string_optional.rs deleted file mode 100644 index a7184bff50..0000000000 --- a/k8s-openapi-codegen-common/templates/query_string_optional.rs +++ /dev/null @@ -1,12 +0,0 @@ - -{operation_feature_attribute}impl{type_generics_impl} {type_name}{type_generics_type}{type_generics_where} {{ - #[doc(hidden)] - /// Serializes this object to a [`{local}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. - {vis}fn __serialize( - self, - __query_pairs: &mut {local}url::form_urlencoded::Serializer<'_, T>, - ) where T: {local}url::form_urlencoded::Target {{ -{fields_append_pair}{watch_append_pair} }} -}} \ No newline at end of file diff --git a/k8s-openapi-codegen-common/templates/type_header.rs b/k8s-openapi-codegen-common/templates/type_header.rs index 6c2335d669..27d6793859 100644 --- a/k8s-openapi-codegen-common/templates/type_header.rs +++ b/k8s-openapi-codegen-common/templates/type_header.rs @@ -1,3 +1,3 @@ // Generated from definition {definition_path} -{type_comment}{type_feature_attribute}{derives}{vis} \ No newline at end of file +{type_comment}{derives}{vis} \ No newline at end of file diff --git a/k8s-openapi-codegen/src/fixups/special.rs b/k8s-openapi-codegen/src/fixups/special.rs index 6568b93ba8..25842a8ef3 100644 --- a/k8s-openapi-codegen/src/fixups/special.rs +++ b/k8s-openapi-codegen/src/fixups/special.rs @@ -80,131 +80,6 @@ pub(crate) mod json_ty { } } -// This fixup copies the `io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions` type to `io.k8s.DeleteOptional` and modifies its parameters to be optional borrows. -// This makes the new type consistent with `io.k8s.ListOptional` and `io.k8s.WatchOptional` and allows it to be used as a common parameter for -// delete and delete-collection API operations. -// -// The original `DeleteOptions` type is still kept since it's used as a field of `io.k8s.api.policy.v1beta1.Eviction` -pub(crate) fn create_delete_optional(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - let delete_options_schema = - spec.definitions.get("io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions") - .ok_or("could not find io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions")?; - let crate::swagger20::SchemaKind::Properties(delete_options_properties) = &delete_options_schema.kind else { - return Err("io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions is not a SchemaKind::Properties".into()); - }; - let delete_optional_properties = delete_options_properties.iter().map(|(name, (schema, _))| (name.clone(), schema.clone())).collect(); - - spec.definitions.insert(crate::swagger20::DefinitionPath("io.k8s.DeleteOptional".to_owned()), crate::swagger20::Schema { - description: Some("Common parameters for all delete and delete-collection operations.".to_owned()), - kind: crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::DeleteOptional(delete_optional_properties)), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); - - Ok(()) -} - -// This fixup extracts the common optional parameters of some operations into common types. -pub(crate) fn create_optionals(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - #[allow(clippy::type_complexity)] - const OPTIONALS: &[( - &str, - &str, - crate::swagger20::KubernetesAction, - fn(std::collections::BTreeMap) -> crate::swagger20::Type, - )] = &[ - ("create", "io.k8s.CreateOptional", crate::swagger20::KubernetesAction::Post, crate::swagger20::Type::CreateOptional), - ("patch", "io.k8s.PatchOptional", crate::swagger20::KubernetesAction::Patch, crate::swagger20::Type::PatchOptional), - ("replace", "io.k8s.ReplaceOptional", crate::swagger20::KubernetesAction::Put, crate::swagger20::Type::ReplaceOptional), - ]; - - for &(description, type_name, kubernetes_action, ty) in OPTIONALS { - let mut optional_parameters: Option> = None; - let mut optional_definition: std::collections::BTreeMap = Default::default(); - - let optional_parameter = std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: type_name.to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - }); - - for operation in &mut spec.operations { - if operation.kubernetes_action != Some(kubernetes_action) { - continue; - } - - if !operation.id.starts_with(description) { - return Err(format!( - "operation {} has action {:?} but isn't a {description} operation", - operation.id, operation.kubernetes_action).into()); - } - - { - let optional_parameters = - &*optional_parameters - .get_or_insert_with(|| - operation.parameters.iter() - .filter_map(|p| if p.required { None } else { Some(p.name.clone()) }) - .collect()); - - for expected_parameter_name in optional_parameters { - let expected_parameter = - operation.parameters.iter() - .find(|p| p.name == *expected_parameter_name && !p.required) - .ok_or_else(|| format!( "operation {} is a {description} operation but doesn't have a {expected_parameter_name} parameter", operation.id))?; - - optional_definition - .entry(crate::swagger20::PropertyName(expected_parameter_name.clone())) - .or_insert_with(|| expected_parameter.schema.clone()); - } - - for parameter in &operation.parameters { - if !parameter.required && !optional_parameters.contains(&*parameter.name) { - return Err(format!("operation {} contains unexpected optional parameter {}", operation.id, parameter.name).into()); - } - } - } - - operation.parameters = - operation.parameters.drain(..) - .filter(|p| p.required) - .chain(std::iter::once(optional_parameter.clone())) - .collect(); - } - - if optional_definition.is_empty() { - return Err(format!("never found any {description} operations").into()); - } - - // Not useful for programmatic clients. - let _ = optional_definition.remove("pretty"); - - spec.definitions.insert(crate::swagger20::DefinitionPath(type_name.to_string()), crate::swagger20::Schema { - description: Some(format!("Common parameters for all {description} operations.")), - kind: crate::swagger20::SchemaKind::Ty(ty(optional_definition)), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); - } - - Ok(()) -} - // Annotate the `patch` type as `swagger20::Type::Patch` for special codegen. pub(crate) fn patch(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { let definition_path = crate::swagger20::DefinitionPath("io.k8s.apimachinery.pkg.apis.meta.v1.Patch".to_owned()); @@ -216,345 +91,6 @@ pub(crate) fn patch(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Erro Err("never applied Patch override".into()) } -// The spec describes delete-collection operations as having query parameters that are a union of parameters of list and delete operations. -// In particular, they have watch-specific parameters that shouldn't be there, and get removed for regular list operations by -// the `separate_watch_from_list_operations` fixup below. -// -// So replace these path=query parameters with `ListOptional` and `DeleteOptions` parameters. -pub(crate) fn remove_delete_collection_operations_query_parameters(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::DeleteCollection) { - operation.parameters = operation.parameters.drain(..).filter(|p| p.location == crate::swagger20::ParameterLocation::Path).collect(); - operation.parameters.push(std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Body, - name: "deleteOptional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("Delete options. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.DeleteOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })); - operation.parameters.push(std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Query, - name: "listOptional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("List options. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.ListOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })); - - found = true; - } - } - - if found { - Ok(()) - } - else { - Err("never applied remove-delete-collection-operations-query-parameters fixup".into()) - } -} - -// Delete operations duplicate some of the properties of their path=body `DeleteOptions` parameter with path=query parameters. -// -// Remove the path=query parameters and replace the path=body parameter with an `io.k8s.DeleteOptional` parameter. -pub(crate) fn remove_delete_operations_query_parameters(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Delete) { - if let Some(body_parameter) = operation.parameters.iter().find(|p| p.location == crate::swagger20::ParameterLocation::Body) { - if let crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { path, .. }) = &body_parameter.schema.kind { - if path == "io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions" { - operation.parameters = operation.parameters.drain(..).filter(|p| p.location == crate::swagger20::ParameterLocation::Path).collect(); - operation.parameters.push(std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Body, - name: "optional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.DeleteOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })); - found = true; - continue; - } - } - - return Err(format!("DELETE operation {} does not have a DeleteOptions body parameter", operation.id).into()); - } - } - } - - if found { - Ok(()) - } - else { - Err("never applied remove-delete-operations-query-parameters fixup".into()) - } -} - -// Read operations have a `pretty` parameter to pretty-print the output. This is not useful for programmatic clients, so this fixup removes it. -// -// Since almost all read operations have only this parameter, such operations have their optional parameters type eliminated entirely as a result. -// To be precise, the only read operation that still has optional parameters is `readCoreV1NamespacedPodLog`. -pub(crate) fn remove_read_operations_query_parameters(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Get) { - operation.parameters.retain(|p| match &*p.name { - "pretty" => { found = true; false } - _ => true, - }); - } - } - - if found { - Ok(()) - } - else { - Err("never applied remove-pretty-parameter fixup".into()) - } -} - -// Some watch and watchlist operations (eg `watchCoreV1NamespacedPod` and `watchCoreV1NamespacedPodList`) are deprecated in favor of the corresponding list operation -// (eg `listCoreV1NamespacedPod`). The watch operation is equivalent to using the list operation with `watch=true` and `field_selector=...`, and the watchlist operation -// to using the list operation with just `watch=true`. -// -// This fixup removes such watch and watchlist operations from the parsed spec entirely. It then synthesizes two functions - a list operation and a watch operation. -// Neither function has a `watch` parameter, but the `watch` operation sets `watch=true` in its URL's query string implicitly. It uses the list operation's URI and -// parameters as a base. -// -// This also helps solve the problem that the default list operation's response type is a list type, which would be incorrect if the user called the function -// with the `watch` parameter set. Thus it's applied even to those list operations which don't have corresponding deprecated watch or watchlist operations. -// -// This fixup also synthesizes mod-root-level `ListOptional` and `WatchOptional` types which have the common parameters of all list and watch operations respectively. -pub(crate) fn separate_watch_from_list_operations(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - use std::fmt::Write; - - let mut list_optional_parameters: Option> = None; - let mut list_optional_definition: std::collections::BTreeMap = Default::default(); - let mut watch_optional_definition: std::collections::BTreeMap = Default::default(); - let mut list_operations = vec![]; - - for operation in &mut spec.operations { - if operation.kubernetes_action != Some(crate::swagger20::KubernetesAction::List) { - continue; - } - - if !operation.id.starts_with("list") { - return Err(format!(r#"operation {} is a list operation but doesn't start with "list""#, operation.id).into()); - } - - let list_optional_parameters = - &*list_optional_parameters.get_or_insert_with(|| operation.parameters.iter().map(|p| p.name.clone()).collect()); - - for expected_parameter_name in list_optional_parameters { - let expected_parameter = - operation.parameters.iter() - .find(|p| p.name == *expected_parameter_name && !p.required) - .ok_or_else(|| format!("operation {} is a list operation but doesn't have a {expected_parameter_name} parameter", operation.id))?; - - if - expected_parameter_name != "allowWatchBookmarks" && - expected_parameter_name != "sendInitialEvents" && - expected_parameter_name != "watch" - { - list_optional_definition - .entry(crate::swagger20::PropertyName(expected_parameter_name.clone())) - .or_insert_with(|| expected_parameter.schema.clone()); - } - - if - expected_parameter_name != "continue" && - expected_parameter_name != "limit" && - expected_parameter_name != "watch" - { - watch_optional_definition - .entry(crate::swagger20::PropertyName(expected_parameter_name.clone())) - .or_insert_with(|| expected_parameter.schema.clone()); - } - } - - for parameter in &operation.parameters { - if !parameter.required && !list_optional_parameters.contains(&*parameter.name) { - return Err(format!("operation {} contains unexpected optional parameter {}", operation.id, parameter.name).into()); - } - } - - list_operations.push(operation.id.clone()); - } - - if list_operations.is_empty() { - return Err("never found any list-watch operations".into()); - } - - // Not useful for programmatic clients. - let _ = list_optional_definition.remove("pretty"); - let _ = watch_optional_definition.remove("pretty"); - - spec.definitions.insert(crate::swagger20::DefinitionPath("io.k8s.ListOptional".to_string()), crate::swagger20::Schema { - description: Some("Common parameters for all list operations.".to_string()), - kind: crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::ListOptional(list_optional_definition)), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); - - spec.definitions.insert(crate::swagger20::DefinitionPath("io.k8s.WatchOptional".to_string()), crate::swagger20::Schema { - description: Some("Common parameters for all watch operations.".to_string()), - kind: crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::WatchOptional(watch_optional_definition)), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); - - let list_optional_parameter = std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.ListOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - }); - - let watch_optional_parameter = std::sync::Arc::new(crate::swagger20::Parameter { - location: crate::swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: crate::swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.WatchOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }, - }); - - let mut converted_watch_operations: std::collections::HashSet<_> = Default::default(); - - for list_operation_id in list_operations { - let watch_operation_id = list_operation_id.replacen("list", "watch", 1); - let watch_list_operation_id = - if watch_operation_id.ends_with("ForAllNamespaces") { - watch_operation_id[..(watch_operation_id.len() - "ForAllNamespaces".len())].to_owned() + "ListForAllNamespaces" - } - else { - watch_operation_id.clone() + "List" - }; - - if let Some(watch_operation_index) = spec.operations.iter().position(|o| o.id == watch_operation_id) { - spec.operations.swap_remove(watch_operation_index); - } - if let Some(watch_list_operation_index) = spec.operations.iter().position(|o| o.id == watch_list_operation_id) { - spec.operations.swap_remove(watch_list_operation_index); - } - - let (original_list_operation_index, original_list_operation) = spec.operations.iter().enumerate().find(|(_, o)| o.id == list_operation_id).unwrap(); - - let mut base_description = original_list_operation.description.as_ref().map_or("", std::ops::Deref::deref).to_owned(); - if !base_description.is_empty() { - writeln!(base_description)?; - writeln!(base_description)?; - } - - let mut list_operation = crate::swagger20::Operation { - description: Some({ - let mut description = base_description.clone(); - writeln!(description, "This operation only supports listing all items of this type.")?; - description - }), - ..original_list_operation.clone() - }; - list_operation.parameters = - list_operation.parameters.into_iter() - .filter(|parameter| parameter.required) - .chain(std::iter::once(list_optional_parameter.clone())) - .collect(); - - let mut watch_operation = crate::swagger20::Operation { - description: Some({ - let mut description = base_description.clone(); - writeln!(description, "This operation only supports watching one item, or a list of items, of this type for changes.")?; - description - }), - id: watch_operation_id.clone(), - kubernetes_action: Some(crate::swagger20::KubernetesAction::Watch), - ..original_list_operation.clone() - }; - watch_operation.parameters = - watch_operation.parameters.into_iter() - .filter(|parameter| parameter.required) - .chain(std::iter::once(watch_optional_parameter.clone())) - .collect(); - let crate::swagger20::OperationResponses::Map(responses) = &mut watch_operation.responses else { unreachable!(); }; - responses.insert(http::StatusCode::OK, crate::swagger20::Schema { - description: Some("OK".to_owned()), - kind: crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { - path: "io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); - - spec.operations[original_list_operation_index] = list_operation; - spec.operations.push(watch_operation); - converted_watch_operations.insert(watch_operation_id); - } - - for operation in &spec.operations { - if let Some(crate::swagger20::KubernetesAction::Watch | crate::swagger20::KubernetesAction::WatchList) = operation.kubernetes_action { - if !converted_watch_operations.contains(&operation.id) { - return Err(format!("found a watch operation that wasn't synthesized from a list operation: {operation:?}").into()); - } - } - } - - Ok(()) -} - // Annotate the `WatchEvent` type as `swagger20::Type::WatchEvent` for special codegen. pub(crate) fn watch_event(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { use std::fmt::Write; @@ -733,385 +269,6 @@ pub(crate) fn list(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error } } } - - for operation in &mut spec.operations { - let crate::swagger20::OperationResponses::Map(responses) = &mut operation.responses else { unreachable!(); }; - for response in responses.values_mut() { - let response_schema_kind = &mut response.kind; - if let crate::swagger20::SchemaKind::Ref(crate::swagger20::RefPath { path, .. }) = response_schema_kind { - if path == &definition_path.0 { - *response_schema_kind = crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::ListRef { - items: Box::new(crate::swagger20::SchemaKind::Ref(item_ref_path.clone())), - }); - } - } - } - } - } - - Ok(()) -} - -// Define the common types for API responses as `swagger20::Type::<>Def`, and replace all references to the original types with `swagger20::Type::<>Ref` for special codegen. -pub(crate) fn response_types(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - #[allow(clippy::type_complexity)] - const TYPES: &[(&str, fn(&mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error>)] = &[ - ("io.k8s.CreateResponse", create_response), - ("io.k8s.DeleteResponse", delete_and_delete_collection_response), - ("io.k8s.ListResponse", list_response), - ("io.k8s.PatchResponse", patch_response), - ("io.k8s.ReplaceResponse", replace_response), - ("io.k8s.WatchResponse", watch_response), - ]; - - fn create_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Post) { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK, http::StatusCode::CREATED, http::StatusCode::ACCEPTED] { - return Err(format!("operation {} does not have the expected response status codes of a create operation: {response_status_codes:?}", - operation.id).into()); - } - - let group_version_kind = - operation.kubernetes_group_kind_version.as_ref() - .ok_or_else(|| format!("operation {} looks like a create but doesn't have a group-version-kind", operation.id))?; - let expected_ref_path_suffix = format!(".{}", group_version_kind.kind); - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ref(ref_path) = kind { - ref_path.path.ends_with(&expected_ref_path_suffix) - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::CreateResponse); - - found = true; - } - } - - if !found { - return Err("did not find any create operations".into()); - } - - Ok(( - "The common response type for all create API operations.", - crate::swagger20::Type::CreateResponse, - )) - } - - fn delete_and_delete_collection_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found_delete = false; - let mut found_delete_collection = false; - - for operation in &mut spec.operations { - match operation.kubernetes_action { - Some(crate::swagger20::KubernetesAction::Delete) => { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK, http::StatusCode::ACCEPTED] { - return Err(format!("operation {} does not have the expected response status codes of a delete operation: {response_status_codes:?}", - operation.id).into()); - } - - // Prevent the Iterator::all closure below capturing all of `self` and complain about conflicting borrows - let definitions = &spec.definitions; - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| { - let crate::swagger20::SchemaKind::Ref(ref_path) = kind else { return false; }; - - if ref_path.path == "io.k8s.apimachinery.pkg.apis.meta.v1.Status" { - return true; - } - - if let Some(kubernetes_group_kind_version) = &operation.kubernetes_group_kind_version { - let Some(response_schema) = definitions.get(&*ref_path.path) else { - panic!("operation {} returns undefined type {kubernetes_group_kind_version:?}", operation.id); - }; - if response_schema.kubernetes_group_kind_versions.contains(kubernetes_group_kind_version) { - return true; - } - } - - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::DeleteResponse); - - found_delete = true; - }, - - Some(crate::swagger20::KubernetesAction::DeleteCollection) => { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK] // delete-collection does not have 202, but we'll synthesize it anyway - { - return Err(format!("operation {} does not have the expected response status codes of a delete-collection operation: {response_status_codes:?}", - operation.id).into()); - } - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ref(ref_path) = kind { - ref_path.path == "io.k8s.apimachinery.pkg.apis.meta.v1.Status" - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::DeleteResponse); - - found_delete_collection = true; - }, - - _ => (), - } - } - - if !found_delete { - return Err("did not find any delete operations".into()); - } - - if !found_delete_collection { - return Err("did not find any delete-collection operations".into()); - } - - Ok(( - "The common response type for all delete API operations and delete-collection API operations.", - crate::swagger20::Type::DeleteResponse, - )) - } - - fn list_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::List) { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK] { - return Err(format!("operation {} does not have the expected response status codes of a list operation: {response_status_codes:?}", - operation.id).into()); - } - - let group_version_kind = - operation.kubernetes_group_kind_version.as_ref() - .ok_or_else(|| format!("operation {} looks like a list but doesn't have a group-version-kind", operation.id))?; - let expected_ref_path_suffix = format!(".{}", group_version_kind.kind); - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::ListRef { items }) = kind { - if let crate::swagger20::SchemaKind::Ref(ref_path) = &**items { - ref_path.path.ends_with(&expected_ref_path_suffix) - } - else { - false - } - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ListResponse); - - found = true; - } - } - - if !found { - return Err("did not find any list operations".into()); - } - - Ok(( - "The common response type for all list API operations.", - crate::swagger20::Type::ListResponse, - )) - } - - fn patch_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Patch) { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK, http::StatusCode::CREATED] { - return Err(format!("operation {} does not have the expected response status codes of a patch operation: {response_status_codes:?}", - operation.id).into()); - } - - let group_version_kind = - operation.kubernetes_group_kind_version.as_ref() - .ok_or_else(|| format!("operation {} looks like a patch but doesn't have a group-version-kind", operation.id))?; - let expected_ref_path_suffix = format!(".{}", group_version_kind.kind); - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ref(ref_path) = kind { - ref_path.path.ends_with(&expected_ref_path_suffix) - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::PatchResponse); - - found = true; - } - } - - if !found { - return Err("did not find any patch operations".into()); - } - - Ok(( - "The common response type for all patch API operations.", - crate::swagger20::Type::PatchResponse, - )) - } - - fn replace_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Put) { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK, http::StatusCode::CREATED] { - return Err(format!("operation {} does not have the expected response status codes of a replace operation: {response_status_codes:?}", - operation.id).into()); - } - - let group_version_kind = - operation.kubernetes_group_kind_version.as_ref() - .ok_or_else(|| format!("operation {} looks like a replace but doesn't have a group-version-kind", operation.id))?; - let expected_ref_path_suffix = format!(".{}", group_version_kind.kind); - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ref(ref_path) = kind { - ref_path.path.ends_with(&expected_ref_path_suffix) - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::ReplaceResponse); - - found = true; - } - } - - if !found { - return Err("did not find any replace operations".into()); - } - - Ok(( - "The common response type for all replace API operations.", - crate::swagger20::Type::ReplaceResponse, - )) - } - - fn watch_response(spec: &mut crate::swagger20::Spec) -> Result<(&'static str, crate::swagger20::Type), crate::Error> { - let mut found = false; - - for operation in &mut spec.operations { - if operation.kubernetes_action == Some(crate::swagger20::KubernetesAction::Watch) { - let crate::swagger20::OperationResponses::Map(responses) = &operation.responses else { unreachable!(); }; - - let mut response_status_codes: Vec<_> = responses.keys().copied().collect(); - response_status_codes.sort(); - if response_status_codes != [http::StatusCode::OK] { - return Err(format!("operation {} does not have the expected response status codes of a watch operation: {response_status_codes:?}", - operation.id).into()); - } - - let should_use_common_response_type = - responses.values() - .all(|crate::swagger20::Schema { kind, .. }| - if let crate::swagger20::SchemaKind::Ref(ref_path) = kind { - ref_path.path == "io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent" - } - else { - false - }); - if !should_use_common_response_type { - continue; - } - - operation.responses = crate::swagger20::OperationResponses::Common(crate::swagger20::Type::WatchResponse); - - found = true; - } - } - - if !found { - return Err("did not find any watch operations".into()); - } - - Ok(( - "The common response type for all watch API operations.", - crate::swagger20::Type::WatchResponse, - )) - } - - for &(definition_path, run) in TYPES { - let (description, ty) = run(spec)?; - - spec.definitions.insert( - crate::swagger20::DefinitionPath(definition_path.to_owned()), - crate::swagger20::Schema { - description: Some(description.to_owned()), - kind: crate::swagger20::SchemaKind::Ty(ty), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }); } Ok(()) diff --git a/k8s-openapi-codegen/src/fixups/upstream_bugs.rs b/k8s-openapi-codegen/src/fixups/upstream_bugs.rs index 1ae2f15100..5ba45bc1fa 100644 --- a/k8s-openapi-codegen/src/fixups/upstream_bugs.rs +++ b/k8s-openapi-codegen/src/fixups/upstream_bugs.rs @@ -49,46 +49,6 @@ pub(crate) fn connect_options_gvk(spec: &mut crate::swagger20::Spec) -> Result<( } } -// Path operation "connectCoreV1GetNamespacedPodExec" claims to take `command: string` parameter in the query string. -// This is not a single string but an array of strings, encoded as multiple query string parameters. -pub(crate) fn pod_exec_command_parameter_type(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { - let mut found = false; - - if let Some(operation) = spec.operations.iter_mut().find(|operation| operation.id == "connectCoreV1GetNamespacedPodExec") { - if let Some(parameter) = operation.parameters.iter_mut().find(|p| p.name == "command") { - if let crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::String { format: None }) = parameter.schema.kind { - *parameter = std::sync::Arc::new(crate::swagger20::Parameter { - location: parameter.location, - name: parameter.name.clone(), - required: parameter.required, - schema: crate::swagger20::Schema { - kind: crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::Array { - items: Box::new(crate::swagger20::Schema { - description: None, - kind: crate::swagger20::SchemaKind::Ty(crate::swagger20::Type::String { format: None }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: crate::swagger20::MergeType::Default, - impl_deep_merge: true, - }), - }), - ..(parameter.schema.clone()) - }, - }); - - found = true; - } - } - } - - if found { - Ok(()) - } - else { - Err("never applied connectCoreV1GetNamespacedPodExec command parameter type override".into()) - } -} - // The spec says that this property is an array, but it can be null. // // Override it to be optional to achieve the same effect. diff --git a/k8s-openapi-codegen/src/main.rs b/k8s-openapi-codegen/src/main.rs index 1539773f72..ee90186c3a 100644 --- a/k8s-openapi-codegen/src/main.rs +++ b/k8s-openapi-codegen/src/main.rs @@ -2,7 +2,6 @@ #![deny(clippy::all, clippy::pedantic)] #![allow( clippy::default_trait_access, - clippy::let_underscore_untyped, clippy::let_unit_value, clippy::too_many_lines, )] @@ -196,7 +195,6 @@ async fn run( let mut num_generated_structs = 0_usize; let mut num_generated_type_aliases = 0_usize; - let mut num_generated_apis = 0_usize; let mut spec: swagger20::Spec = { log::info!("Parsing spec file at {spec_url} ..."); @@ -227,9 +225,8 @@ async fn run( supported_version.fixup(&mut spec)?; let expected_num_generated_types: usize = spec.definitions.len(); - let expected_num_generated_apis: usize = spec.operations.len(); - log::info!("OK. Spec has {expected_num_generated_types} definitions and {expected_num_generated_apis} operations"); + log::info!("OK. Spec has {expected_num_generated_types} definitions."); loop { log::info!("Removing output directory {} ...", out_dir.display()); @@ -268,53 +265,21 @@ async fn run( &MapNamespace, "pub ", k8s_openapi_codegen_common::GenerateSchema::Yes { feature: Some("schemars") }, - Some("api"), run_state, )?; num_generated_structs += run_result.num_generated_structs; num_generated_type_aliases += run_result.num_generated_type_aliases; - num_generated_apis += run_result.num_generated_apis; - } - - // Top-level operations - { - let mut mod_root_file = std::io::BufWriter::new(std::fs::OpenOptions::new().append(true).open(out_dir.join("mod.rs"))?); - - spec.operations.sort_by(|o1, o2| o1.id.cmp(&o2.id)); - for operation in spec.operations { - if let Some(swagger20::KubernetesGroupKindVersion { group, kind, version }) = operation.kubernetes_group_kind_version { - return Err(format!( - "Operation {} is associated with {group}/{version}/{kind} but did not get emitted with that definition", - operation.id).into()); - } - - k8s_openapi_codegen_common::write_operation( - &mut mod_root_file, - &operation, - &MapNamespace, - "pub ", - None, - Some("api"), - )?; - - num_generated_apis += 1; - } } log::info!("OK"); log::info!("Generated {num_generated_structs} structs"); log::info!("Generated {num_generated_type_aliases} type aliases"); - log::info!("Generated {num_generated_apis} API functions"); if num_generated_structs + num_generated_type_aliases != expected_num_generated_types { return Err("Did not generate or skip expected number of types".into()); } - if num_generated_apis != expected_num_generated_apis { - return Err("Did not generate expected number of API functions".into()); - } - log::info!(""); Ok(()) @@ -342,11 +307,7 @@ struct RunState<'a> { impl k8s_openapi_codegen_common::RunState for RunState<'_> { type Writer = std::io::BufWriter; - fn make_writer( - &mut self, - parts: &[&str], - type_feature: Option<&str>, - ) -> std::io::Result { + fn make_writer(&mut self, parts: &[&str]) -> std::io::Result { use std::io::Write; let mut current = self.out_dir.to_owned(); @@ -387,13 +348,7 @@ impl k8s_openapi_codegen_common::RunState for RunState<'_> { let mut parent_mod_rs = std::io::BufWriter::new(std::fs::OpenOptions::new().append(true).create(true).open(current.join("mod.rs"))?); writeln!(parent_mod_rs)?; - if let Some(type_feature) = type_feature { - writeln!(parent_mod_rs, r#"#[cfg(feature = {type_feature:?})]"#)?; - } writeln!(parent_mod_rs, "mod {mod_name};")?; - if let Some(type_feature) = type_feature { - writeln!(parent_mod_rs, r#"#[cfg(feature = {type_feature:?})]"#)?; - } writeln!(parent_mod_rs, "pub use self::{mod_name}::{type_name};")?; let file_name = current.join(&*mod_name).with_extension("rs"); @@ -404,32 +359,5 @@ impl k8s_openapi_codegen_common::RunState for RunState<'_> { Ok(file) } - fn handle_operation_types( - &mut self, - operation_optional_parameters_name: Option<&str>, - operation_result_name: Option<&str>, - ) -> std::io::Result<()> { - use std::io::Write; - - let (parent_mod_rs, mod_name) = self.parent_mod_rs_file_and_mod_name.as_mut().unwrap(); - match (operation_optional_parameters_name, operation_result_name) { - (Some(operation_optional_parameters_name), Some(operation_result_name)) => - writeln!( - parent_mod_rs, - r#"#[cfg(feature = "api")] pub use self::{mod_name}::{{{operation_optional_parameters_name}, {operation_result_name}}};"#)?, - (Some(operation_optional_parameters_name), None) => - writeln!( - parent_mod_rs, - r#"#[cfg(feature = "api")] pub use self::{mod_name}::{operation_optional_parameters_name};"#)?, - (None, Some(operation_result_name)) => - writeln!( - parent_mod_rs, - r#"#[cfg(feature = "api")] pub use self::{mod_name}::{operation_result_name};"#)?, - (None, None) => - (), - } - Ok(()) - } - fn finish(&mut self, _writer: Self::Writer) { } } diff --git a/k8s-openapi-codegen/src/supported_version.rs b/k8s-openapi-codegen/src/supported_version.rs index 586f9062b4..4e4a092146 100644 --- a/k8s-openapi-codegen/src/supported_version.rs +++ b/k8s-openapi-codegen/src/supported_version.rs @@ -58,33 +58,28 @@ impl SupportedVersion { crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1beta1_event, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, ], SupportedVersion::V1_23 => &[ crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1beta1_event, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, ], SupportedVersion::V1_24 => &[ crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1beta1_event, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, ], SupportedVersion::V1_25 => &[ crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, ], SupportedVersion::V1_26 => &[ crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, crate::fixups::upstream_bugs::required_properties::validating_admission_policy_binding_list, crate::fixups::upstream_bugs::required_properties::validating_admission_policy_list, crate::fixups::upstream_bugs::status_extra_gvk, @@ -93,7 +88,6 @@ impl SupportedVersion { SupportedVersion::V1_27 => &[ crate::fixups::upstream_bugs::connect_options_gvk, crate::fixups::upstream_bugs::optional_properties::eventsv1_event, - crate::fixups::upstream_bugs::pod_exec_command_parameter_type, crate::fixups::upstream_bugs::required_properties::validating_admission_policy_binding_list, crate::fixups::upstream_bugs::required_properties::validating_admission_policy_list, crate::fixups::upstream_bugs::status_extra_gvk, @@ -104,16 +98,9 @@ impl SupportedVersion { crate::fixups::special::json_ty::json_schema_props_or_array, crate::fixups::special::json_ty::json_schema_props_or_bool, crate::fixups::special::json_ty::json_schema_props_or_string_array, - crate::fixups::special::create_delete_optional, - crate::fixups::special::create_optionals, crate::fixups::special::patch, - crate::fixups::special::remove_delete_collection_operations_query_parameters, - crate::fixups::special::remove_delete_operations_query_parameters, - crate::fixups::special::remove_read_operations_query_parameters, - crate::fixups::special::separate_watch_from_list_operations, crate::fixups::special::watch_event, - crate::fixups::special::list, // Must run after separate_watch_from_list_operations - crate::fixups::special::response_types, + crate::fixups::special::list, crate::fixups::special::resource_metadata_not_optional, ]; diff --git a/k8s-openapi-derive/src/custom_resource_definition.rs b/k8s-openapi-derive/src/custom_resource_definition.rs index d6c931a49c..ed99f8a0ce 100644 --- a/k8s-openapi-derive/src/custom_resource_definition.rs +++ b/k8s-openapi-derive/src/custom_resource_definition.rs @@ -145,57 +145,12 @@ impl super::CustomDerive for CustomResourceDefinition { (cr_spec_name_string, cr_name_string) }; - let body_parameter = - std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "body".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: cr_name.clone(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - }); - - let name_parameter = - std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Path, - name: "name".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some(format!("name of the `{cr_name}`")), - kind: swagger20::SchemaKind::Ty(swagger20::Type::String { format: None }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - }); - - let (namespace_operation_id_component, namespace_parameter, namespace_path_component) = + let (namespace_operation_id_component, namespace_path_component) = if namespaced { - ("Namespaced", Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Path, - name: "namespace".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("object name and auth scope, such as for teams and projects".to_owned()), - kind: swagger20::SchemaKind::Ty(swagger20::Type::String { format: None }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), "/namespaces/{namespace}") + ("Namespaced", "/namespaces/{namespace}") } else { - ("", None, "") + ("", "") }; let mut spec = swagger20::Spec { @@ -270,411 +225,124 @@ impl super::CustomDerive for CustomResourceDefinition { ].into(), operations: vec![ swagger20::Operation { - description: Some(format!("Create a `{cr_name}`")), id: format!("create{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Post, kubernetes_action: Some(swagger20::KubernetesAction::Post), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(body_parameter.clone()), - namespace_parameter.clone(), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::CreateResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Delete a `{cr_name}`")), id: format!("delete{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Delete, kubernetes_action: Some(swagger20::KubernetesAction::Delete), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(name_parameter.clone()), - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.DeleteOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::DeleteResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Delete a collection of objects of kind `{cr_name}`")), id: format!("deleteCollection{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Delete, kubernetes_action: Some(swagger20::KubernetesAction::DeleteCollection), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Query, - name: "deleteOptional".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("Delete options. Use `Default::default()` to not pass any.".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.DeleteOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Query, - name: "listOptional".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("List options. Use `Default::default()` to not pass any.".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.ListOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::DeleteResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("List objects of kind `{cr_name}`")), id: format!("list{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Get, kubernetes_action: Some(swagger20::KubernetesAction::List), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.ListOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::ListResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Partially update the specified `{cr_name}`")), id: format!("patch{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Patch, kubernetes_action: Some(swagger20::KubernetesAction::Patch), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "body".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.apimachinery.pkg.apis.meta.v1.Patch".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - Some(name_parameter.clone()), - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.PatchOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::PatchResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Partially update the state of the specified `{cr_name}`")), id: format!("patch{namespace_operation_id_component}{cr_name}Status"), - method: swagger20::Method::Patch, kubernetes_action: Some(swagger20::KubernetesAction::Patch), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "body".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.apimachinery.pkg.apis.meta.v1.Patch".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - Some(name_parameter.clone()), - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.PatchOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}/status")), - responses: swagger20::OperationResponses::Common(swagger20::Type::PatchResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Read the specified `{cr_name}`")), id: format!("read{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Get, kubernetes_action: Some(swagger20::KubernetesAction::Get), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(name_parameter.clone()), - namespace_parameter.clone(), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}")), - responses: swagger20::OperationResponses::Map([ - (http::StatusCode::OK, swagger20::Schema { - description: Some("OK".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: cr_name.clone(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }), - ].into()), - tag: None, }, swagger20::Operation { - description: Some(format!("Read status of the specified `{cr_name}`")), id: format!("read{namespace_operation_id_component}{cr_name}Status"), - method: swagger20::Method::Get, kubernetes_action: Some(swagger20::KubernetesAction::Get), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(name_parameter.clone()), - namespace_parameter.clone(), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}/status")), - responses: swagger20::OperationResponses::Map([ - (http::StatusCode::OK, swagger20::Schema { - description: Some("OK".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: cr_name.clone(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }), - ].into()), - tag: None, }, swagger20::Operation { - description: Some(format!("Replace the specified `{cr_name}`")), id: format!("replace{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Put, kubernetes_action: Some(swagger20::KubernetesAction::Put), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(body_parameter.clone()), - Some(name_parameter.clone()), - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.ReplaceOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::ReplaceResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Replace status of the specified `{cr_name}`")), id: format!("replace{namespace_operation_id_component}{cr_name}Status"), - method: swagger20::Method::Put, kubernetes_action: Some(swagger20::KubernetesAction::Put), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - Some(body_parameter), - Some(name_parameter), - namespace_parameter.clone(), - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Body, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: None, - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.ReplaceOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}/{{name}}/status")), - responses: swagger20::OperationResponses::Common(swagger20::Type::ReplaceResponse), - tag: None, }, swagger20::Operation { - description: Some(format!("Watch objects of kind `{cr_name}`")), id: format!("watch{namespace_operation_id_component}{cr_name}"), - method: swagger20::Method::Get, kubernetes_action: Some(swagger20::KubernetesAction::Watch), kubernetes_group_kind_version: Some(swagger20::KubernetesGroupKindVersion { group: group.clone(), kind: cr_name.clone(), version: version.clone(), }), - parameters: [ - namespace_parameter, - Some(std::sync::Arc::new(swagger20::Parameter { - location: swagger20::ParameterLocation::Query, - name: "optional".to_owned(), - required: true, - schema: swagger20::Schema { - description: Some("Optional parameters. Use `Default::default()` to not pass any.".to_owned()), - kind: swagger20::SchemaKind::Ref(swagger20::RefPath { - path: "io.k8s.WatchOptional".to_owned(), - can_be_default: None, - }), - kubernetes_group_kind_versions: vec![], - list_kind: None, - merge_type: swagger20::MergeType::Default, - impl_deep_merge: true, - }, - })), - ].into_iter().flatten().collect(), path: swagger20::Path(format!("/apis/{group}/{version}{namespace_path_component}/{plural}")), - responses: swagger20::OperationResponses::Common(swagger20::Type::WatchResponse), - tag: None, }, ], }; @@ -691,7 +359,6 @@ impl super::CustomDerive for CustomResourceDefinition { &MapNamespace, &vis, if generate_schema { k8s_openapi_codegen_common::GenerateSchema::Yes { feature: None } } else { k8s_openapi_codegen_common::GenerateSchema::No }, - None, &mut run_state, ) .map_err(|err| format!("#[derive(CustomResourceDefinition)] failed: {err}")) @@ -723,22 +390,10 @@ struct RunState { impl k8s_openapi_codegen_common::RunState for RunState { type Writer = Vec; - fn make_writer( - &mut self, - _parts: &[&str], - _type_feature: Option<&str>, - ) -> std::io::Result { + fn make_writer(&mut self, _parts: &[&str]) -> std::io::Result { Ok(std::mem::take(&mut self.writer)) } - fn handle_operation_types( - &mut self, - _operation_optional_parameters_name: Option<&str>, - _operation_result_name: Option<&str>, - ) -> std::io::Result<()> { - Ok(()) - } - fn finish(&mut self, writer: Self::Writer) { self.writer = writer; } diff --git a/k8s-openapi-derive/src/lib.rs b/k8s-openapi-derive/src/lib.rs index c523fc0507..16490b2e45 100644 --- a/k8s-openapi-derive/src/lib.rs +++ b/k8s-openapi-derive/src/lib.rs @@ -2,7 +2,6 @@ #![warn(rust_2018_idioms)] #![deny(clippy::all, clippy::pedantic)] #![allow( - clippy::let_underscore_untyped, clippy::too_many_lines, )] @@ -149,183 +148,10 @@ impl ResultExt for Result where E: std::fmt::Display { /// ..Default::default() /// }; /// -/// let (request, response_body) = -/// apiextensions::CustomResourceDefinition::create(&custom_resource_definition, Default::default()) -/// .expect("couldn't create custom resource definition"); -/// let response = client.execute(request).expect("couldn't create custom resource definition"); +/// client.create(custom_resource_definition); /// ``` /// -/// The macro also generates clientset functions associated with the custom resource type to create, get, update, etc. -/// This is just like a regular Kubernetes resource type like `Pod`. -/// -/// ```rust,ignore -/// impl FooBar { -/// /// Create a FooBar -/// fn create( -/// namespace: &str, -/// body: &FooBar, -/// optional: k8s_openapi::DeleteOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Delete a FooBar -/// fn delete( -/// name: &str, -/// namespace: &str, -/// optional: k8s_openapi::DeleteOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Delete a collection of objects of kind FooBar -/// fn delete_collection( -/// namespace: &str, -/// delete_optional: k8s_openapi::DeleteOptional<'_>, -/// list_optional: k8s_openapi::ListOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody>> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// List objects of kind FooBar -/// fn list( -/// namespace: &str, -/// optional: k8s_openapi::ListOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Partially update the specified FooBar -/// fn patch( -/// name: &str, -/// namespace: &str, -/// body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch, -/// optional: k8s_openapi::PatchOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Partially update the state of the specified FooBar -/// fn patch_status( -/// name: &str, -/// namespace: &str, -/// body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch, -/// optional: k8s_openapi::PatchOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Read the specified FooBar -/// fn read( -/// name: &str, -/// namespace: &str, -/// ) -> Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody -/// ), -/// k8s_openapi::RequestError, -/// > { ... } -/// -/// /// Read status of the specified FooBar -/// fn read_status( -/// name: &str, -/// namespace: &str, -/// ) -> Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody -/// ), -/// k8s_openapi::RequestError, -/// > { ... } -/// -/// /// Replace the specified FooBar -/// fn replace( -/// name: &str, -/// namespace: &str, -/// body: &FooBar, -/// optional: k8s_openapi::ReplaceOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Replace status of the specified FooBar -/// fn replace_status( -/// name: &str, -/// namespace: &str, -/// body: &FooBar, -/// optional: k8s_openapi::ReplaceOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// -/// /// Watch objects of kind FooBar -/// fn watch( -/// namespace: &str, -/// optional: k8s_openapi::WatchOptional<'_>, -/// ) -> -/// Result< -/// ( -/// k8s_openapi::http::Request>, -/// fn(k8s_openapi::http::StatusCode) -> k8s_openapi::ResponseBody> -/// ), -/// k8s_openapi::RequestError, -/// > -/// { ... } -/// } -/// ``` -/// -/// (You may wish to generate your own crate's docs, or run it through `cargo-expand`, to be able to see the macro expansion.) -/// -/// Refer to [the `k8s-openapi` crate docs](https://arnavion.github.io/k8s-openapi/) to learn more about how to use the return values of these functions. +/// (You may wish to generate run your crate through `cargo-expand` to see the macro expansion.) /// /// See the [`custom_resource_definition` test in the repository](https://github.com/Arnavion/k8s-openapi/blob/master/k8s-openapi-tests/src/custom_resource_definition.rs) /// for a full example of using this custom derive. diff --git a/k8s-openapi-tests/Cargo.toml b/k8s-openapi-tests/Cargo.toml index feddda7694..9b49457add 100644 --- a/k8s-openapi-tests/Cargo.toml +++ b/k8s-openapi-tests/Cargo.toml @@ -15,16 +15,19 @@ include = [ base64 = { version = "0.21", default-features = false, features = [ "alloc", # for base64::Engine::decode and base64::Engine::encode ] } +bytes = { version = "1", default-features = false} dirs = { version = "5", default-features = false } futures-core = { version = "0.3", default-features = false } futures-io = { version = "0.3", default-features = false } futures-util = { version = "0.3", default-features = false, features = [ "io", # for futures_util::StreamExt::into_async_read ] } +http = { version = "0.2", default-features = false } k8s-openapi = { path = "..", features = [ "schemars", # for resource types: schemars::JsonSchema ] } k8s-openapi-derive = { path = "../k8s-openapi-derive" } +percent-encoding = { version = "2", default-features = false } pin-project = { version = "1", default-features = false } reqwest = { version = "0.11.2", default-features = false, features = [ "rustls-tls-manual-roots", # for TLS support @@ -42,6 +45,7 @@ tokio = { version = "1", default-features = false, features = [ "test-util", # for tokio::time::pause "time", # for tokio::time::sleep ] } +url = { version = "2", default-features = false } [features] test_v1_22 = ["k8s-openapi/v1_22"] diff --git a/k8s-openapi-tests/src/api_versions.rs b/k8s-openapi-tests/src/api_versions.rs index d3af02d538..f4a11c4176 100644 --- a/k8s-openapi-tests/src/api_versions.rs +++ b/k8s-openapi-tests/src/api_versions.rs @@ -2,9 +2,9 @@ async fn list() { let mut client = crate::Client::new("api_versions-list"); - let (request, response_body) = k8s_openapi::get_api_versions().expect("couldn't get API versions"); + let (request, response_body) = crate::clientset::get_api_versions(); let api_versions = match client.get_single_value(request, response_body).await { - (k8s_openapi::GetAPIVersionsResponse::Ok(api_versions), _) => api_versions, + (crate::clientset::GetAPIVersionsResponse::Ok(api_versions), _) => api_versions, (other, status_code) => panic!("{other:?} {status_code}"), }; diff --git a/k8s-openapi-tests/src/clientset/create.rs b/k8s-openapi-tests/src/clientset/create.rs new file mode 100644 index 0000000000..d4e97c70ff --- /dev/null +++ b/k8s-openapi-tests/src/clientset/create.rs @@ -0,0 +1,85 @@ +use k8s_openapi::serde_json; + +pub(crate) fn create_cluster( + body: &T, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + serde::Serialize + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/{url_path_segment}", + api_version = T::API_VERSION, + url_path_segment = T::URL_PATH_SEGMENT, + ); + + let request = http::Request::post(url); + let request = request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json")); + let body = serde_json::to_vec(body).unwrap(); + let request = request.body(body).unwrap(); + (request, super::ResponseBody::new) +} + +pub(crate) fn create_namespaced( + namespace: &str, + body: &T, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + serde::Serialize + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + ); + + let request = http::Request::post(url); + let request = request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json")); + let body = serde_json::to_vec(body).unwrap(); + let request = request.body(body).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum CreateResponse where T: serde::de::DeserializeOwned { + Ok(T), + Created(T), + Other(Result, serde_json::Error>), +} + +impl super::Response for CreateResponse where T: serde::de::DeserializeOwned { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + match status_code { + http::StatusCode::OK => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + Ok((Self::Ok(result), buf.len())) + }, + http::StatusCode::CREATED => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + Ok((Self::Created(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/clientset/delete.rs b/k8s-openapi-tests/src/clientset/delete.rs new file mode 100644 index 0000000000..8167c1b057 --- /dev/null +++ b/k8s-openapi-tests/src/clientset/delete.rs @@ -0,0 +1,86 @@ +use k8s_openapi::serde_json; + +pub(crate) fn delete_cluster( + name: &str, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/{url_path_segment}/{name}", + api_version = T::API_VERSION, + url_path_segment = T::URL_PATH_SEGMENT, + name = percent_encoding::percent_encode(name.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + ); + + let request = http::Request::delete(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +pub(crate) fn delete_namespaced( + namespace: &str, + name: &str, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}/{name}", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + name = percent_encoding::percent_encode(name.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + ); + + let request = http::Request::delete(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum DeleteResponse where T: serde::de::DeserializeOwned { + OkStatus(k8s_openapi::apimachinery::pkg::apis::meta::v1::Status), + OkValue(T), + Other(Result, serde_json::Error>), +} + +impl super::Response for DeleteResponse where T: serde::de::DeserializeOwned { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let result: serde_json::Map = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + let is_status = matches!(result.get("kind"), Some(serde_json::Value::String(s)) if s == "Status"); + if is_status { + let result = serde::Deserialize::deserialize(serde_json::Value::Object(result)); + let result = result.map_err(super::ResponseError::Json)?; + Ok((Self::OkStatus(result), buf.len())) + } + else { + let result = serde::Deserialize::deserialize(serde_json::Value::Object(result)); + let result = result.map_err(super::ResponseError::Json)?; + Ok((Self::OkValue(result), buf.len())) + } + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/clientset/delete_collection.rs b/k8s-openapi-tests/src/clientset/delete_collection.rs new file mode 100644 index 0000000000..da53612496 --- /dev/null +++ b/k8s-openapi-tests/src/clientset/delete_collection.rs @@ -0,0 +1,37 @@ +pub(crate) fn delete_collection_namespaced( + namespace: &str, + list_optional: ListOptional<'_>, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource + k8s_openapi::ListableResource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}?", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + ); + let mut query_pairs = url::form_urlencoded::Serializer::new(url); + list_optional.serialize(&mut query_pairs); + let url = query_pairs.finish(); + + let request = http::Request::delete(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub(crate) struct ListOptional<'a> { + pub(crate) label_selector: Option<&'a str>, +} + +impl<'a> ListOptional<'a> { + fn serialize( + self, + query_pairs: &mut url::form_urlencoded::Serializer<'_, T>, + ) where T: url::form_urlencoded::Target { + if let Some(value) = self.label_selector { + query_pairs.append_pair("labelSelector", value); + } + } +} diff --git a/k8s-openapi-tests/src/clientset/list.rs b/k8s-openapi-tests/src/clientset/list.rs new file mode 100644 index 0000000000..4ed4530f1a --- /dev/null +++ b/k8s-openapi-tests/src/clientset/list.rs @@ -0,0 +1,55 @@ +use k8s_openapi::serde_json; + +pub(crate) fn list_namespaced( + namespace: &str, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource + k8s_openapi::ListableResource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + ); + + let request = http::Request::get(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum ListResponse where T: serde::de::DeserializeOwned + k8s_openapi::ListableResource { + Ok(k8s_openapi::List), + Other(Result, serde_json::Error>), +} + +impl super::Response for ListResponse where T: serde::de::DeserializeOwned + k8s_openapi::ListableResource { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + Ok((Self::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/clientset/mod.rs b/k8s-openapi-tests/src/clientset/mod.rs new file mode 100644 index 0000000000..4e9a47015f --- /dev/null +++ b/k8s-openapi-tests/src/clientset/mod.rs @@ -0,0 +1,145 @@ +use k8s_openapi::serde_json; + +mod create; +pub(crate) use create::{create_cluster, create_namespaced, CreateResponse}; + +mod delete; +pub(crate) use delete::{delete_cluster, delete_namespaced, DeleteResponse}; + +mod delete_collection; +pub(crate) use delete_collection::{delete_collection_namespaced, ListOptional}; + +mod list; +pub(crate) use list::{list_namespaced, ListResponse}; + +mod patch; +pub(crate) use patch::{patch_namespaced, PatchResponse}; + +mod read; +pub(crate) use read::{read_cluster, read_namespaced, ReadResponse}; + +mod watch; +pub(crate) use watch::{watch_namespaced, WatchResponse}; +#[allow(unused_imports)] +pub(crate) use watch::WatchOptional; + +pub(crate) struct ResponseBody { + pub(crate) status_code: http::StatusCode, + buf: bytes::BytesMut, + _response: std::marker::PhantomData T>, +} + +impl ResponseBody where T: Response { + pub(crate) fn new(status_code: http::StatusCode) -> Self { + ResponseBody { + status_code, + buf: Default::default(), + _response: Default::default(), + } + } + + pub(crate) fn append_slice(&mut self, buf: &[u8]) { + self.buf.extend_from_slice(buf); + } + + pub(crate) fn parse(&mut self) -> Result { + match T::try_from_parts(self.status_code, &self.buf) { + Ok((result, read)) => { + self.advance(read); + Ok(result) + }, + + Err(err) => Err(err), + } + } + + pub(crate) fn advance(&mut self, cnt: usize) { + bytes::Buf::advance(&mut self.buf, cnt); + } +} + +impl std::ops::Deref for ResponseBody { + type Target = [u8]; + + fn deref(&self) -> &Self::Target { + &self.buf + } +} + +pub(crate) trait Response: Sized { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), ResponseError>; +} + +#[derive(Debug)] +pub enum ResponseError { + NeedMoreData, + Json(serde_json::Error), +} + +impl std::fmt::Display for ResponseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ResponseError::NeedMoreData => f.write_str("need more response data"), + ResponseError::Json(err) => write!(f, "{err}"), + } + } +} + +impl std::error::Error for ResponseError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + ResponseError::NeedMoreData => None, + ResponseError::Json(err) => Some(err), + } + } +} + +pub(crate) fn get_api_versions() -> (http::Request>, fn(http::StatusCode) -> ResponseBody) { + let url = "/apis".to_owned(); + + let request = http::Request::get(url); + let request = request.body(vec![]).unwrap(); + (request, ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum GetAPIVersionsResponse { + Ok(k8s_openapi::apimachinery::pkg::apis::meta::v1::APIGroupList), + Other(Result, serde_json::Error>), +} + +impl Response for GetAPIVersionsResponse { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(ResponseError::NeedMoreData), + Err(err) => return Err(ResponseError::Json(err)), + }; + Ok((Self::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} + +/// Ref +const PATH_SEGMENT_ENCODE_SET: &percent_encoding::AsciiSet = + &percent_encoding::CONTROLS + .add(b' ').add(b'"').add(b'<').add(b'>').add(b'`') // fragment percent-encode set + .add(b'#').add(b'?').add(b'{').add(b'}'); // path percent-encode set diff --git a/k8s-openapi-tests/src/clientset/patch.rs b/k8s-openapi-tests/src/clientset/patch.rs new file mode 100644 index 0000000000..5e87393bf4 --- /dev/null +++ b/k8s-openapi-tests/src/clientset/patch.rs @@ -0,0 +1,64 @@ +use k8s_openapi::serde_json; + +pub(crate) fn patch_namespaced( + namespace: &str, + name: &str, + body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}/{name}", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + name = percent_encoding::percent_encode(name.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + ); + + let request = http::Request::patch(url); + let request = request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static(match body { + k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json", + k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json", + k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json", + })); + let body = serde_json::to_vec(body).unwrap(); + let request = request.body(body).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum PatchResponse where T: serde::de::DeserializeOwned { + Ok(T), + Other(Result, serde_json::Error>), +} + +impl super::Response for PatchResponse where T: serde::de::DeserializeOwned { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + Ok((Self::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/clientset/read.rs b/k8s-openapi-tests/src/clientset/read.rs new file mode 100644 index 0000000000..c5b91e171c --- /dev/null +++ b/k8s-openapi-tests/src/clientset/read.rs @@ -0,0 +1,75 @@ +use k8s_openapi::serde_json; + +pub(crate) fn read_cluster( + name: &str, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/{url_path_segment}/{name}", + api_version = T::API_VERSION, + url_path_segment = T::URL_PATH_SEGMENT, + name = percent_encoding::percent_encode(name.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + ); + + let request = http::Request::get(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +pub(crate) fn read_namespaced( + namespace: &str, + name: &str, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}/{name}", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + name = percent_encoding::percent_encode(name.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + ); + + let request = http::Request::get(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Debug)] +pub(crate) enum ReadResponse where T: serde::de::DeserializeOwned { + Ok(T), + Other(Result, serde_json::Error>), +} + +impl super::Response for ReadResponse where T: serde::de::DeserializeOwned { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let result = match serde_json::from_slice(buf) { + Ok(value) => value, + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => return Err(super::ResponseError::Json(err)), + }; + Ok((Self::Ok(result), buf.len())) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/clientset/watch.rs b/k8s-openapi-tests/src/clientset/watch.rs new file mode 100644 index 0000000000..875d067cd3 --- /dev/null +++ b/k8s-openapi-tests/src/clientset/watch.rs @@ -0,0 +1,90 @@ +use k8s_openapi::serde_json; + +pub(crate) fn watch_namespaced( + namespace: &str, + optional: WatchOptional<'_>, +) -> (http::Request>, fn(http::StatusCode) -> super::ResponseBody>) +where + T: serde::de::DeserializeOwned + k8s_openapi::Resource, +{ + let first_segment = if T::GROUP.is_empty() { "api" } else { "apis" }; + let url = format!("/{first_segment}/{api_version}/namespaces/{namespace}/{url_path_segment}?", + api_version = T::API_VERSION, + namespace = percent_encoding::percent_encode(namespace.as_bytes(), super::PATH_SEGMENT_ENCODE_SET), + url_path_segment = T::URL_PATH_SEGMENT, + ); + let mut query_pairs = url::form_urlencoded::Serializer::new(url); + optional.serialize(&mut query_pairs); + let url = query_pairs.finish(); + + let request = http::Request::get(url); + let request = request.body(vec![]).unwrap(); + (request, super::ResponseBody::new) +} + +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub(crate) struct WatchOptional<'a> { + pub(crate) allow_watch_bookmarks: Option, + pub(crate) resource_version: Option<&'a str>, + pub(crate) resource_version_match: Option<&'a str>, + pub(crate) send_initial_events: Option, +} + +impl<'a> WatchOptional<'a> { + fn serialize( + self, + query_pairs: &mut url::form_urlencoded::Serializer<'_, T>, + ) where T: 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.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.send_initial_events { + query_pairs.append_pair("sendInitialEvents", if value { "true" } else { "false" }); + } + query_pairs.append_pair("watch", "true"); + } +} + +#[derive(Debug)] +pub(crate) enum WatchResponse where T: serde::de::DeserializeOwned { + Ok(k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent), + Other(Result, serde_json::Error>), +} + +impl super::Response for WatchResponse where T: serde::de::DeserializeOwned { + fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), super::ResponseError> { + #[allow(clippy::single_match_else)] + match status_code { + http::StatusCode::OK => { + let mut deserializer = 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(super::ResponseError::NeedMoreData), + Some(Err(err)) => return Err(super::ResponseError::Json(err)), + None => return Err(super::ResponseError::NeedMoreData), + }; + Ok((Self::Ok(result), byte_offset)) + }, + _ => { + let (result, read) = + if buf.is_empty() { + (Ok(None), 0) + } + else { + match serde_json::from_slice(buf) { + Ok(value) => (Ok(Some(value)), buf.len()), + Err(err) if err.is_eof() => return Err(super::ResponseError::NeedMoreData), + Err(err) => (Err(err), 0), + } + }; + Ok((Self::Other(result), read)) + }, + } + } +} diff --git a/k8s-openapi-tests/src/custom_resource_definition.rs b/k8s-openapi-tests/src/custom_resource_definition.rs index 7aaed43716..0392a2fd2f 100644 --- a/k8s-openapi-tests/src/custom_resource_definition.rs +++ b/k8s-openapi-tests/src/custom_resource_definition.rs @@ -1,5 +1,5 @@ use futures_util::StreamExt; -use k8s_openapi::{http, schemars, serde_json}; +use k8s_openapi::{schemars, serde_json}; #[tokio::test] async fn test() { @@ -157,11 +157,9 @@ async fn test() { }; loop { - let (request, response_body) = - apiextensions::CustomResourceDefinition::create(&custom_resource_definition, Default::default()) - .expect("couldn't create custom resource definition"); + let (request, response_body) = crate::clientset::create_cluster::(&custom_resource_definition); match client.get_single_value(request, response_body).await { - (k8s_openapi::CreateResponse::Created(_), _) | + (crate::clientset::CreateResponse::Created(_), _) | (_, http::StatusCode::CONFLICT) => break, (_, http::StatusCode::INTERNAL_SERVER_ERROR) => (), (other, status_code) => panic!("{other:?} {status_code}"), @@ -171,11 +169,9 @@ async fn test() { // Wait for CRD to be registered loop { let (request, response_body) = - apiextensions::CustomResourceDefinition::read( - &format!("{plural}.{}", ::GROUP.to_owned())) - .expect("couldn't get custom resource definition"); + crate::clientset::read_cluster::(&format!("{plural}.{}", ::GROUP.to_owned())); let custom_resource_definition = match client.get_single_value(request, response_body).await { - (apiextensions::ReadCustomResourceDefinitionResponse::Ok(custom_resource_definition), _) => custom_resource_definition, + (crate::clientset::ReadResponse::Ok(custom_resource_definition), _) => custom_resource_definition, (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -206,19 +202,17 @@ async fn test() { }), subresources: Default::default(), }; - let (request, response_body) = - FooBar::create("default", &fb1) - .expect("couldn't create FooBar"); + let (request, response_body) = crate::clientset::create_namespaced::("default", &fb1); let fb1 = match client.get_single_value(request, response_body).await { - (k8s_openapi::CreateResponse::Ok(fb) | k8s_openapi::CreateResponse::Created(fb), _) => fb, + (crate::clientset::CreateResponse::Ok(fb) | crate::clientset::CreateResponse::Created(fb), _) => fb, (other, status_code) => panic!("{other:?} {status_code}"), }; // List CR - let (request, response_body) = FooBar::list("default", Default::default()).expect("couldn't list FooBars"); - let foo_bar_list: k8s_openapi::List = match client.get_single_value(request, response_body).await { - (k8s_openapi::ListResponse::Ok(foo_bar_list), _) => foo_bar_list, + let (request, response_body) = crate::clientset::list_namespaced::("default"); + let foo_bar_list = match client.get_single_value(request, response_body).await { + (crate::clientset::ListResponse::Ok(foo_bar_list), _) => foo_bar_list, (other, status_code) => panic!("{other:?} {status_code}"), }; assert_eq!(k8s_openapi::kind(&foo_bar_list), "FooBarList"); @@ -230,9 +224,9 @@ async fn test() { // Read CR - let (request, response_body) = FooBar::read("fb1", "default").expect("couldn't read FooBar"); + let (request, response_body) = crate::clientset::read_namespaced::("default", "fb1"); let fb1_2 = match client.get_single_value(request, response_body).await { - (ReadFooBarResponse::Ok(fb), _) => fb, + (crate::clientset::ReadResponse::Ok(fb), _) => fb, (other, status_code) => panic!("{other:?} {status_code}"), }; assert_eq!(fb1_2.metadata.name.as_ref().unwrap(), "fb1"); @@ -240,14 +234,14 @@ async fn test() { // Watch CR { - let (request, response_body) = FooBar::watch("default", Default::default()).expect("couldn't watch FooBars"); + let (request, response_body) = crate::clientset::watch_namespaced::("default", Default::default()); let foo_bar_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let _ = foo_bar_watch_events .filter_map(|foo_bar_watch_event| { let fb = match foo_bar_watch_event { - (k8s_openapi::WatchResponse::Ok(meta::WatchEvent::Added(fb)), _) => fb, - (k8s_openapi::WatchResponse::Ok(_), _) => return std::future::ready(None), + (crate::clientset::WatchResponse::Ok(meta::WatchEvent::Added(fb)), _) => fb, + (crate::clientset::WatchResponse::Ok(_), _) => return std::future::ready(None), (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -269,10 +263,10 @@ async fn test() { let metadata = &fb1.metadata; let name = metadata.name.as_ref().expect("create FooBar response did not set metadata.name"); let namespace = metadata.namespace.as_ref().expect("create FooBar response did not set metadata.namespace"); - FooBar::delete(name, namespace, Default::default()).expect("couldn't delete FooBar") + crate::clientset::delete_namespaced::(namespace, name) }; let () = match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -294,7 +288,7 @@ async fn test() { .header(http::header::CONTENT_TYPE, "application/json") .body(serde_json::to_vec(&fb2).expect("couldn't create custom resource definition")) .expect("couldn't create custom resource"); - match client.get_single_value(request, k8s_openapi::ResponseBody::>::new).await { + match client.get_single_value(request, crate::clientset::ResponseBody::>::new).await { (_, http::StatusCode::UNPROCESSABLE_ENTITY) => (), (other, status_code) => panic!("{other:?} {status_code}"), } @@ -316,7 +310,7 @@ async fn test() { .header(http::header::CONTENT_TYPE, "application/json") .body(serde_json::to_vec(&fb3).expect("couldn't create custom resource definition")) .expect("couldn't create custom resource"); - match client.get_single_value(request, k8s_openapi::ResponseBody::>::new).await { + match client.get_single_value(request, crate::clientset::ResponseBody::>::new).await { (_, http::StatusCode::UNPROCESSABLE_ENTITY) => (), (other, status_code) => panic!("{other:?} {status_code}"), } @@ -324,12 +318,9 @@ async fn test() { // Delete CRD let (request, response_body) = - apiextensions::CustomResourceDefinition::delete( - &format!("{plural}.{}", ::GROUP), - Default::default()) - .expect("couldn't delete custom resource definition"); + crate::clientset::delete_cluster::(&format!("{plural}.{}", ::GROUP)); match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } } diff --git a/k8s-openapi-tests/src/deployment.rs b/k8s-openapi-tests/src/deployment.rs index fdb06c1b3f..2b8f8019e5 100644 --- a/k8s-openapi-tests/src/deployment.rs +++ b/k8s-openapi-tests/src/deployment.rs @@ -5,11 +5,9 @@ async fn list() { let mut client = crate::Client::new("deployment-list"); - let (request, response_body) = - apps::Deployment::list("kube-system", Default::default()) - .expect("couldn't list deployments"); + let (request, response_body) = crate::clientset::list_namespaced::("kube-system"); let deployment_list = match client.get_single_value(request, response_body).await { - (k8s_openapi::ListResponse::Ok(deployment_list), _) => deployment_list, + (crate::clientset::ListResponse::Ok(deployment_list), _) => deployment_list, (other, status_code) => panic!("{other:?} {status_code}"), }; diff --git a/k8s-openapi-tests/src/job.rs b/k8s-openapi-tests/src/job.rs index 14c1f77c16..18933318a7 100644 --- a/k8s-openapi-tests/src/job.rs +++ b/k8s-openapi-tests/src/job.rs @@ -46,11 +46,9 @@ async fn create() { ..Default::default() }; - let (request, response_body) = - batch::Job::create("default", &job, Default::default()) - .expect("couldn't create job"); - let job: batch::Job = match client.get_single_value(request, response_body).await { - (k8s_openapi::CreateResponse::Created(job), _) => job, + let (request, response_body) = crate::clientset::create_namespaced::("default", &job); + let job = match client.get_single_value(request, response_body).await { + (crate::clientset::CreateResponse::Created(job), _) => job, (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -70,9 +68,9 @@ async fn create() { // Wait for job to fail loop { - let (request, response_body) = batch::Job::read(&job_name, "default").expect("couldn't get job"); - let job: batch::Job = match client.get_single_value(request, response_body).await { - (batch::ReadJobResponse::Ok(job), _) => job, + let (request, response_body) = crate::clientset::read_namespaced::("default", &job_name); + let job = match client.get_single_value(request, response_body).await { + (crate::clientset::ReadResponse::Ok(job), _) => job, (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -89,9 +87,9 @@ async fn create() { // Find a pod of the failed job using owner reference let job_pod_status = loop { - let (request, response_body) = api::Pod::list("default", Default::default()).expect("couldn't list pods"); + let (request, response_body) = crate::clientset::list_namespaced::("default"); let pod_list = match client.get_single_value(request, response_body).await { - (k8s_openapi::ListResponse::Ok(pod_list), _) => pod_list, + (crate::clientset::ListResponse::Ok(pod_list), _) => pod_list, (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -121,25 +119,18 @@ async fn create() { .terminated.expect("couldn't get job pod container termination info"); assert_eq!(job_pod_container_state_terminated.exit_code, 5); - let (request, response_body) = batch::Job::delete(&job_name, "default", Default::default()).expect("couldn't delete job"); + let (request, response_body) = crate::clientset::delete_namespaced::("default", &job_name); match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } // Delete all pods of the job using label selector - let (request, response_body) = - api::Pod::delete_collection( - "default", - Default::default(), - k8s_openapi::ListOptional { - label_selector: Some("job-name=k8s-openapi-tests-create-job"), - ..Default::default() - }, - ) - .expect("couldn't delete pods collection"); + let (request, response_body) = crate::clientset::delete_collection_namespaced::("default", crate::clientset::ListOptional { + label_selector: Some("job-name=k8s-openapi-tests-create-job"), + }); match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } } diff --git a/k8s-openapi-tests/src/lib.rs b/k8s-openapi-tests/src/lib.rs index c9c5f02abd..df5b097120 100644 --- a/k8s-openapi-tests/src/lib.rs +++ b/k8s-openapi-tests/src/lib.rs @@ -4,10 +4,11 @@ #![deny(clippy::all, clippy::pedantic)] #![allow( clippy::default_trait_access, + clippy::large_enum_variant, clippy::let_and_return, - clippy::let_underscore_untyped, clippy::let_unit_value, clippy::too_many_lines, + clippy::type_complexity, )] use std::{future::Future, pin::Pin, task::{Context, Poll}}; @@ -15,7 +16,7 @@ use std::{future::Future, pin::Pin, task::{Context, Poll}}; use futures_core::Stream; use futures_io::AsyncRead; use futures_util::{StreamExt, TryStreamExt}; -use k8s_openapi::{http, serde_json}; +use k8s_openapi::serde_json; #[derive(Debug)] enum Client { @@ -161,8 +162,8 @@ impl Client { async fn get_single_value( &mut self, request: http::Request>, - response_body: fn(http::StatusCode) -> k8s_openapi::ResponseBody, - ) -> (R, http::StatusCode) where R: k8s_openapi::Response { + response_body: fn(http::StatusCode) -> clientset::ResponseBody, + ) -> (R, http::StatusCode) where R: clientset::Response { let mut stream = std::pin::pin!(self.get_multiple_values(request, response_body)); stream.next().await.expect("unexpected EOF") } @@ -170,8 +171,8 @@ impl Client { fn get_multiple_values<'a, R>( &'a mut self, request: http::Request>, - response_body: fn(http::StatusCode) -> k8s_openapi::ResponseBody, - ) -> impl Stream + 'a where R: k8s_openapi::Response + 'a { + response_body: fn(http::StatusCode) -> clientset::ResponseBody, + ) -> impl Stream + 'a where R: clientset::Response + 'a { MultipleValuesStream::ExecutingRequest { f: self.execute(request), response_body, @@ -313,12 +314,12 @@ enum MultipleValuesStream<'a, TResponseFuture, TResponse, R> { ExecutingRequest { #[pin] f: TResponseFuture, - response_body: fn(http::StatusCode) -> k8s_openapi::ResponseBody, + response_body: fn(http::StatusCode) -> clientset::ResponseBody, }, Response { #[pin] response: ClientResponse<'a, TResponse>, - response_body: k8s_openapi::ResponseBody, + response_body: clientset::ResponseBody, buf: Box<[u8; 4096]>, }, } @@ -326,7 +327,7 @@ enum MultipleValuesStream<'a, TResponseFuture, TResponse, R> { impl<'a, TResponseFuture, TResponse, R> Stream for MultipleValuesStream<'a, TResponseFuture, TResponse, R> where TResponseFuture: Future>, ClientResponse<'a, TResponse>: AsyncRead, - R: k8s_openapi::Response, + R: clientset::Response, { type Item = (R, http::StatusCode); @@ -362,7 +363,7 @@ impl<'a, TResponseFuture, TResponse, R> Stream for MultipleValuesStream<'a, TRes loop { match response_body.parse() { Ok(value) => return Poll::Ready(Some((value, response_body.status_code))), - Err(k8s_openapi::ResponseError::NeedMoreData) => (), + Err(clientset::ResponseError::NeedMoreData) => (), Err(err) => panic!("{err}"), } @@ -468,8 +469,6 @@ mod bytestring { } mod methodstring { - use super::http; - pub(super) fn deserialize<'de, D>(deserializer: D) -> Result where D: serde::Deserializer<'de> { struct Visitor; @@ -500,6 +499,8 @@ fn deserialize_null_to_empty_vec<'de, D, T>(deserializer: D) -> Result, D mod api_versions; +mod clientset; + mod custom_resource_definition; mod deserialize_leniency; @@ -508,8 +509,6 @@ mod deployment; mod job; -mod logs; - mod patch; mod pod; diff --git a/k8s-openapi-tests/src/logs.rs b/k8s-openapi-tests/src/logs.rs deleted file mode 100644 index b9746e4dbd..0000000000 --- a/k8s-openapi-tests/src/logs.rs +++ /dev/null @@ -1,169 +0,0 @@ -use futures_util::StreamExt; - -#[tokio::test] -async fn get() { - use k8s_openapi::api::core::v1 as api; - - let mut client = crate::Client::new("logs-get"); - - let (request, response_body) = api::Pod::list("kube-system", Default::default()).expect("couldn't list pods"); - let pod_list = match client.get_single_value(request, response_body).await { - (k8s_openapi::ListResponse::Ok(pod_list), _) => pod_list, - (other, status_code) => panic!("{other:?} {status_code}"), - }; - - let apiserver_pod = - pod_list - .items.into_iter() - .find_map(|pod| { - let name = pod.metadata.name.as_deref()?; - if name.starts_with("kube-apiserver-") { - Some(pod) - } - else { - None - } - }) - .expect("couldn't find apiserver pod"); - - let apiserver_pod_name = - apiserver_pod - .metadata - .name.as_ref().expect("couldn't get apiserver pod name"); - - let (request, response_body) = - api::Pod::read_log(apiserver_pod_name, "kube-system", api::ReadPodLogOptional { - container: Some("kube-apiserver"), - ..Default::default() - }) - .expect("couldn't get apiserver pod logs"); - let mut apiserver_logs = String::new(); - let mut chunks = std::pin::pin!(client.get_multiple_values(request, response_body)); - let found_line = loop { - let Some(chunk) = chunks.next().await else { break false; }; - let s = match chunk { - (api::ReadPodLogResponse::Ok(s), _) => s, - (other, status_code) => panic!("{other:?} {status_code}"), - }; - apiserver_logs.push_str(&s); - - if apiserver_logs.contains("Serving securely on [::]:6443") { - break true; - } - - if apiserver_logs.len() > 65536 { - break false; - } - }; - assert!(found_line, "did not find expected text in apiserver pod logs: {apiserver_logs}"); -} - -#[test] -fn partial_and_invalid_utf8_sequences() { - use k8s_openapi::api::core::v1 as api; - - let mut response_body: k8s_openapi::ResponseBody = - k8s_openapi::ResponseBody::new(reqwest::StatusCode::OK); - - // Empty buffer - match response_body.parse() { - Err(k8s_openapi::ResponseError::NeedMoreData) => (), - result => panic!("expected empty buffer to return Err(NeedMoreData), but it returned {result:?}"), - } - - response_body.append_slice(b"a"); - - // Entire buffer is valid - match response_body.parse() { - Ok(api::ReadPodLogResponse::Ok(s)) if s == "a" => (), - result => panic!(r#"expected empty buffer to return Ok("a"), but it returned {result:?}"#), - } - - // Entire buffer must have been consumed, and it should now be empty - assert_eq!(&*response_body, b""); - - // First byte of buffer is invalid - response_body.append_slice(b"\xff"); - - match response_body.parse() { - Err(k8s_openapi::ResponseError::Utf8(err)) if err.valid_up_to() == 0 && err.error_len() == Some(1) => (), - result => panic!("expected empty buffer to return Err(NeedMoreData), but it returned {result:?}"), - } - - // First byte of buffer must not have been consumed, so it's still invalid - match response_body.parse() { - Err(k8s_openapi::ResponseError::Utf8(err)) if err.valid_up_to() == 0 && err.error_len() == Some(1) => (), - result => panic!("expected empty buffer to return Err(Utf8(0, Some(1))), but it returned {result:?}"), - } - - let mut response_body: k8s_openapi::ResponseBody = - k8s_openapi::ResponseBody::new(reqwest::StatusCode::OK); - - response_body.append_slice(b"\xe4"); - - // First byte of buffer is partial - match response_body.parse() { - Err(k8s_openapi::ResponseError::NeedMoreData) => (), - result => panic!("expected empty buffer to return Err(NeedMoreData), but it returned {result:?}"), - } - - response_body.append_slice(b"\xb8"); - - // First two bytes of buffer are partial - match response_body.parse() { - Err(k8s_openapi::ResponseError::NeedMoreData) => (), - result => panic!("expected empty buffer to return Err(NeedMoreData), but it returned {result:?}"), - } - - // Entire buffer is valid - response_body.append_slice(b"\x96"); - - match response_body.parse() { - Ok(api::ReadPodLogResponse::Ok(s)) if s == "\u{4e16}" => (), - result => panic!(r#"expected empty buffer to return Ok("\u{{4e16}}"), but it returned {result:?}"#), - } - - let mut response_body: k8s_openapi::ResponseBody = - k8s_openapi::ResponseBody::new(reqwest::StatusCode::OK); - - response_body.append_slice(b"\xe4\xb8\x96\xe7"); - - // First three bytes are valid. Fourth byte is partial. - match response_body.parse() { - Ok(api::ReadPodLogResponse::Ok(s)) if s == "\u{4e16}" => (), - result => panic!(r#"expected empty buffer to return Ok("\u{{4e16}}"), but it returned {result:?}"#), - } - - // First three bytes must have been consumed. Remaining byte is partial. - assert_eq!(&*response_body, b"\xe7"); - match response_body.parse() { - Err(k8s_openapi::ResponseError::NeedMoreData) => (), - result => panic!("expected empty buffer to return Err(NeedMoreData), but it returned {result:?}"), - } - - response_body.append_slice(b"\x95\x8c"); - - // Entire buffer is valid - match response_body.parse() { - Ok(api::ReadPodLogResponse::Ok(s)) if s == "\u{754c}" => (), - result => panic!(r#"expected empty buffer to return Ok("\u{{754c}}"), but it returned {result:?}"#), - } - - let mut response_body: k8s_openapi::ResponseBody = - k8s_openapi::ResponseBody::new(reqwest::StatusCode::OK); - - response_body.append_slice(b"\xe4\xb8\x96\xff"); - - // First three bytes are valid. Fourth byte is invalid. - match response_body.parse() { - Ok(api::ReadPodLogResponse::Ok(s)) if s == "\u{4e16}" => (), - result => panic!(r#"expected empty buffer to return Ok("\u{{4e16}}"), but it returned {result:?}"#), - } - - // First three bytes must have been consumed. Remaining byte is invalid. - assert_eq!(&*response_body, b"\xff"); - match response_body.parse() { - Err(k8s_openapi::ResponseError::Utf8(err)) if err.valid_up_to() == 0 && err.error_len() == Some(1) => (), - result => panic!("expected empty buffer to return Err(Utf8(0, Some(1))), but it returned {result:?}"), - } -} diff --git a/k8s-openapi-tests/src/patch.rs b/k8s-openapi-tests/src/patch.rs index b9335fe02e..f5fbd4a3bb 100644 --- a/k8s-openapi-tests/src/patch.rs +++ b/k8s-openapi-tests/src/patch.rs @@ -45,11 +45,9 @@ async fn deployment() { spec: Some(deployment_spec), ..Default::default() }; - let (request, response_body) = - apps::Deployment::create("default", &deployment, Default::default()) - .expect("couldn't create deployment"); + let (request, response_body) = crate::clientset::create_namespaced::("default", &deployment); match client.get_single_value(request, response_body).await { - (k8s_openapi::CreateResponse::Created(_), _) => (), + (crate::clientset::CreateResponse::Created(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } @@ -119,39 +117,28 @@ async fn deployment() { // Delete deployment - let (request, response_body) = - apps::Deployment::delete("k8s-openapi-tests-patch-deployment", "default", Default::default()) - .expect("couldn't delete deployment"); + let (request, response_body) = crate::clientset::delete_namespaced::("default", "k8s-openapi-tests-patch-deployment"); match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } // Delete all pods of the deployment using label selector - let (request, response_body) = - api::Pod::delete_collection( - "default", - Default::default(), - k8s_openapi::ListOptional { - label_selector: Some("k8s-openapi-tests-patch-deployment-key=k8s-openapi-tests-patch-deployment-value"), - ..Default::default() - }, - ) - .expect("couldn't delete pods collection"); + let (request, response_body) = crate::clientset::delete_collection_namespaced::("default", crate::clientset::ListOptional { + label_selector: Some("k8s-openapi-tests-patch-deployment-key=k8s-openapi-tests-patch-deployment-value"), + }); match client.get_single_value(request, response_body).await { - (k8s_openapi::DeleteResponse::OkStatus(_) | k8s_openapi::DeleteResponse::OkValue(_), _) => (), + (crate::clientset::DeleteResponse::OkStatus(_) | crate::clientset::DeleteResponse::OkValue(_), _) => (), (other, status_code) => panic!("{other:?} {status_code}"), } } /// Patch the deployment with the given path, and assert that the patched deployment has a container with the expected image async fn patch_and_assert_container_has_image(client: &mut crate::Client, patch: &meta::Patch, expected_image: &str) { - let (request, response_body) = - apps::Deployment::patch("k8s-openapi-tests-patch-deployment", "default", patch, Default::default()) - .expect("couldn't create patch"); + let (request, response_body) = crate::clientset::patch_namespaced::("default", "k8s-openapi-tests-patch-deployment", patch); let deployment = match client.get_single_value(request, response_body).await { - (k8s_openapi::PatchResponse::Ok(deployment), _) => deployment, + (crate::clientset::PatchResponse::Ok(deployment), _) => deployment, (other, status_code) => panic!("{other:?} {status_code}"), }; diff --git a/k8s-openapi-tests/src/pod.rs b/k8s-openapi-tests/src/pod.rs index 53702a9620..31c84a99a1 100644 --- a/k8s-openapi-tests/src/pod.rs +++ b/k8s-openapi-tests/src/pod.rs @@ -4,9 +4,9 @@ async fn list() { let mut client = crate::Client::new("pod-list"); - let (request, response_body) = api::Pod::list("kube-system", Default::default()).expect("couldn't list pods"); + let (request, response_body) = crate::clientset::list_namespaced::("kube-system"); let pod_list = match client.get_single_value(request, response_body).await { - (k8s_openapi::ListResponse::Ok(pod_list), _) => pod_list, + (crate::clientset::ListResponse::Ok(pod_list), _) => pod_list, (other, status_code) => panic!("{other:?} {status_code}"), }; diff --git a/k8s-openapi-tests/src/watch_event.rs b/k8s-openapi-tests/src/watch_event.rs index aca94cb45f..f46c89818a 100644 --- a/k8s-openapi-tests/src/watch_event.rs +++ b/k8s-openapi-tests/src/watch_event.rs @@ -7,16 +7,15 @@ async fn watch_pods() { let mut client = crate::Client::new("watch_event-watch_pods"); - let (request, response_body) = - api::Pod::watch("kube-system", Default::default()).expect("couldn't watch pods"); + let (request, response_body) = crate::clientset::watch_namespaced::("kube-system", Default::default()); let pod_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let apiserver_pod = pod_watch_events .filter_map(|pod_watch_event| { let pod = match pod_watch_event { - (k8s_openapi::WatchResponse::Ok(meta::WatchEvent::Added(pod)), _) => pod, - (k8s_openapi::WatchResponse::Ok(_), _) => return std::future::ready(None), + (crate::clientset::WatchResponse::Ok(meta::WatchEvent::Added(pod)), _) => pod, + (crate::clientset::WatchResponse::Ok(_), _) => return std::future::ready(None), (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -51,22 +50,20 @@ async fn watch_pods_without_initial_events() { let mut client = crate::Client::new("watch_event-watch_pods_without_initial_events"); - let (request, response_body) = - api::Pod::watch("kube-system", k8s_openapi::WatchOptional { - allow_watch_bookmarks: Some(true), - resource_version: Some("0"), - resource_version_match: Some("NotOlderThan"), - send_initial_events: Some(true), - ..Default::default() - }).expect("couldn't watch pods"); + let (request, response_body) = crate::clientset::watch_namespaced::("kube-system", crate::clientset::WatchOptional { + allow_watch_bookmarks: Some(true), + resource_version: Some("0"), + resource_version_match: Some("NotOlderThan"), + send_initial_events: Some(true), + }); let pod_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let initial_events_end_annotation = pod_watch_events .filter_map(|pod_watch_event| { let initial_events_end_annotation = match pod_watch_event { - (k8s_openapi::WatchResponse::Ok(meta::WatchEvent::Bookmark { mut annotations, resource_version: _ }), _) => annotations.remove("k8s.io/initial-events-end"), - (k8s_openapi::WatchResponse::Ok(_), _) => return std::future::ready(None), + (crate::clientset::WatchResponse::Ok(meta::WatchEvent::Bookmark { mut annotations, resource_version: _ }), _) => annotations.remove("k8s.io/initial-events-end"), + (crate::clientset::WatchResponse::Ok(_), _) => return std::future::ready(None), (other, status_code) => panic!("{other:?} {status_code}"), }; @@ -153,13 +150,10 @@ fn bookmark_events() { for (input, expected) in success_test_cases { let watch_response = - k8s_openapi::Response::try_from_parts( - k8s_openapi::http::StatusCode::OK, - input, - ) + crate::clientset::Response::try_from_parts(http::StatusCode::OK, input) .expect("expected hard-coded test case to be deserialized successfully but it failed to deserialize"); let watch_event = match watch_response { - (k8s_openapi::WatchResponse::::Ok(watch_event), read) if read == input.len() => watch_event, + (crate::clientset::WatchResponse::::Ok(watch_event), read) if read == input.len() => watch_event, watch_response => panic!("hard-coded test case did not deserialize as expected: {watch_response:?}"), }; assert_eq!(watch_event, *expected); @@ -167,14 +161,11 @@ fn bookmark_events() { for input in failure_test_cases { let err = - as k8s_openapi::Response>::try_from_parts( - k8s_openapi::http::StatusCode::OK, - input, - ) + as crate::clientset::Response>::try_from_parts(http::StatusCode::OK, input) .expect_err("expected hard-coded failure test case to fail to deserialize but it deserialized successfully"); match err { - k8s_openapi::ResponseError::Json(_) => (), - err => panic!("hard-coded test case did not fail to deserialize as expected: {err:?}"), + crate::clientset::ResponseError::Json(_) => (), + crate::clientset::ResponseError::NeedMoreData => panic!("hard-coded test case did not fail to deserialize as expected: {err:?}"), } } } diff --git a/k8s-openapi-tests/test-replays/v1-22/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-22/api_versions-list.json index 0239f84b62..2767e3a6ed 100644 --- a/k8s-openapi-tests/test-replays/v1-22/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-22/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, 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 4cf424bb3e..7bfbafd9d9 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 @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -32,7 +32,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2022-12-08T22:10:00Z\",\"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-12-08T22:10:00Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"867\",\"uid\":\"6c7b4d24-dd3a-4072-8e54-9756feb47c4d\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -59,7 +59,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"6c7b4d24-dd3a-4072-8e54-9756feb47c4d\"}}\n" }, @@ -83,7 +83,7 @@ "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", + "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\":\"3ef4efdc-3c41-4587-accc-d999bcf28858\",\"resourceVersion\":\"869\",\"generation\":1,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"deletionTimestamp\":\"2022-12-08T22:10:00Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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-12-08T22:09:57Z\",\"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-12-08T22:09:57Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2022-12-08T22:09:57Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2022-12-08T22:10: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-22/deployment-list.json b/k8s-openapi-tests/test-replays/v1-22/deployment-list.json index 643f50c9bf..d1a19ab6e4 100644 --- a/k8s-openapi-tests/test-replays/v1-22/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-22/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, 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 907eabfe92..61d26e1070 100644 --- a/k8s-openapi-tests/test-replays/v1-22/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-22/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -72,7 +72,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"resourceVersion\":\"889\",\"generation\":1,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"labels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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-12-08T22:10:03Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"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-12-08T22:10:03Z\",\"lastTransitionTime\":\"2022-12-08T22:10:03Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-12-08T22:09:57Z\",\"failed\":1}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -83,7 +83,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"resourceVersion\":\"892\",\"generation\":2,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"deletionTimestamp\":\"2022-12-08T22:10:04Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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-12-08T22:10:03Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"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-12-08T22:10:03Z\",\"lastTransitionTime\":\"2022-12-08T22:10:03Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2022-12-08T22:09:57Z\",\"failed\":1}}\n" }, @@ -91,7 +91,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"892\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-lhpfc\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"cc82cda9-f3d2-4526-8544-9860cd8677f7\",\"resourceVersion\":\"887\",\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"labels\":{\"controller-uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"baeb90f8-9f75-4906-8b7c-68395091e179\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:09:57Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"baeb90f8-9f75-4906-8b7c-68395091e179\\\"}\":{}}},\"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-12-08T22:10:03Z\",\"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-mqlph\",\"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-mqlph\",\"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-12-08T22:09:57Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"10.244.0.7\",\"podIPs\":[{\"ip\":\"10.244.0.7\"}],\"startTime\":\"2022-12-08T22:09:57Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2022-12-08T22:10:01Z\",\"finishedAt\":\"2022-12-08T22:10:01Z\",\"containerID\":\"containerd://2b56ba377a4a53f5c125eb56ed01a72450ec61b96c22e17edae06190e21bf353\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4\",\"containerID\":\"containerd://2b56ba377a4a53f5c125eb56ed01a72450ec61b96c22e17edae06190e21bf353\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-22/logs-get.json b/k8s-openapi-tests/test-replays/v1-22/logs-get.json deleted file mode 100644 index 79ecaeb86b..0000000000 --- a/k8s-openapi-tests/test-replays/v1-22/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"815\"},\"items\":[{\"metadata\":{\"name\":\"coredns-7bdbbf6bf5-2zl72\",\"generateName\":\"coredns-7bdbbf6bf5-\",\"namespace\":\"kube-system\",\"uid\":\"3044d418-b5c7-4b81-8a03-f9813a6527dd\",\"resourceVersion\":\"542\",\"creationTimestamp\":\"2022-12-08T22:06:05Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7bdbbf6bf5\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7bdbbf6bf5\",\"uid\":\"cecd01f6-9ed8-40a2-9268-de816319aa5f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:06:05Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"cecd01f6-9ed8-40a2-9268-de816319aa5f\\\"}\":{}}},\"f:spec\":{\"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-12-08T22:06:05Z\",\"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-12-08T22:06:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"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-2vmnf\",\"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.8.4\",\"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-2vmnf\",\"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.22-control-plane\",\"securityContext\":{},\"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-12-08T22:06:17Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:19Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:19Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:17Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2022-12-08T22:06:17Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:06:18Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.4\",\"imageID\":\"sha256:8d147537fb7d1ac8895da4d55a5e53621949981e2e6460976dae812f83d84a44\",\"containerID\":\"containerd://6c24f4e89f5a6d162ad321f53583924013ded6f7dfe088f7734450bb6b0402f9\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-7bdbbf6bf5-nwfj6\",\"generateName\":\"coredns-7bdbbf6bf5-\",\"namespace\":\"kube-system\",\"uid\":\"eeb155d1-8d4e-482c-a1a2-23b49f10cd56\",\"resourceVersion\":\"551\",\"creationTimestamp\":\"2022-12-08T22:06:05Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7bdbbf6bf5\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7bdbbf6bf5\",\"uid\":\"cecd01f6-9ed8-40a2-9268-de816319aa5f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:06:05Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"cecd01f6-9ed8-40a2-9268-de816319aa5f\\\"}\":{}}},\"f:spec\":{\"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-12-08T22:06:05Z\",\"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-12-08T22:06:20Z\",\"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-x7d2q\",\"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.8.4\",\"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-x7d2q\",\"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.22-control-plane\",\"securityContext\":{},\"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-12-08T22:06:17Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:19Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:19Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:17Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2022-12-08T22:06:17Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:06:18Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.4\",\"imageID\":\"sha256:8d147537fb7d1ac8895da4d55a5e53621949981e2e6460976dae812f83d84a44\",\"containerID\":\"containerd://3ddfd256cef59e4effc8ccdc3e28f2ea87351b8f7eabac8fb47d02eae61c1f32\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.22-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"388bd7af-c3d9-47b8-9008-ae48721bbaf0\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2022-12-08T22:05:45Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.24.0.3:2379\",\"kubernetes.io/config.hash\":\"97effb9ec35b52f16207a152af6639c4\",\"kubernetes.io/config.mirror\":\"97effb9ec35b52f16207a152af6639c4\",\"kubernetes.io/config.seen\":\"2022-12-08T22:05:34.617563266Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.22-control-plane\",\"uid\":\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:05:45Z\",\"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\\\":\\\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\\\"}\":{}}},\"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-12-08T22:06:05Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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.6-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.24.0.3:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--initial-advertise-peer-urls=https://172.24.0.3:2380\",\"--initial-cluster=v1.22-control-plane=https://172.24.0.3:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.24.0.3:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.24.0.3:2380\",\"--name=v1.22-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\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health\",\"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.22-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-12-08T22:05:58Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:05Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:05Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:58Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:05:58Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:05:39Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.6-0\",\"imageID\":\"sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7\",\"containerID\":\"containerd://0dead3af4bda24e80f886f9997dfc335a1842ac05e795a5a85ed2c4bb8c848f5\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-p2ddp\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"461a55cb-bb68-48fa-a79f-09eb19b8db10\",\"resourceVersion\":\"502\",\"creationTimestamp\":\"2022-12-08T22:06:05Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"8748bb8c\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"3d6875ee-6775-4706-a8d1-870bf09e8a81\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:06:05Z\",\"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\\\":\\\"3d6875ee-6775-4706-a8d1-870bf09e8a81\\\"}\":{}}},\"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-12-08T22:06:09Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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-mfklb\",\"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:v20221004-44d545d1\",\"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.22-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-mfklb\",\"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.22-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.22-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-12-08T22:06:05Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:09Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:09Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:05Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:06:05Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:06:08Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20221004-44d545d1\",\"imageID\":\"sha256:d6e3e26021b60c625f0ef5b2dd3f9e22d2d398e05bccc4fdd7d59fbbb6a04d3f\",\"containerID\":\"containerd://45d6b41ed273998b44ade7463986457c27656ae9cd042616475f2f262fc1c7b3\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.22-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"80f46a42-5556-40dd-8964-d56eb818f7f9\",\"resourceVersion\":\"400\",\"creationTimestamp\":\"2022-12-08T22:05:48Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.24.0.3:6443\",\"kubernetes.io/config.hash\":\"dbe0ab1ec0cab7d7f00c2f1e396a5429\",\"kubernetes.io/config.mirror\":\"dbe0ab1ec0cab7d7f00c2f1e396a5429\",\"kubernetes.io/config.seen\":\"2022-12-08T22:05:34.617590398Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.22-control-plane\",\"uid\":\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:05:48Z\",\"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\\\":\\\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\\\"}\":{}}},\"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-12-08T22:06:04Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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.22.17\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.24.0.3\",\"--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.24.0.3\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.24.0.3\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.24.0.3\",\"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.22-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-12-08T22:05:58Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:04Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:04Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:58Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:05:58Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:05:38Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-apiserver:v1.22.17\",\"imageID\":\"docker.io/library/import-2022-12-08@sha256:3d3fb008b18f13f9382109c98fa8985db445dd2dedd3e3fd26b0cc404cc87fbf\",\"containerID\":\"containerd://7a72e1137e3e53b323556fa1c8c4e2dda25f35846bcb9b9105be8e595a6b3ea6\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.22-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"4bafeb49-f296-4493-80d5-5311fcf8f431\",\"resourceVersion\":\"359\",\"creationTimestamp\":\"2022-12-08T22:05:50Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"5cb1a54ccf94c5706d4f35ed4b948749\",\"kubernetes.io/config.mirror\":\"5cb1a54ccf94c5706d4f35ed4b948749\",\"kubernetes.io/config.seen\":\"2022-12-08T22:05:34.617593664Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.22-control-plane\",\"uid\":\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:05:50Z\",\"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\\\":\\\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\\\"}\":{}}},\"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-12-08T22:06:02Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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.22.17\",\"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.22\",\"--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\",\"--port=0\",\"--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.22-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-12-08T22:05:58Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:59Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:59Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:58Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:05:58Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:05:38Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-controller-manager:v1.22.17\",\"imageID\":\"docker.io/library/import-2022-12-08@sha256:d065d2f2ff64a35149a8765944142780eaa1e0b2d3ffe7fe7606c9f94b861b67\",\"containerID\":\"containerd://07baf5ae96f5dcbaa235d7df0b55d9882ca4b9ce419c913dd23bb60bcf924e34\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-cmbcq\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"e6146fe8-624f-44c8-859d-9d0131b64836\",\"resourceVersion\":\"500\",\"creationTimestamp\":\"2022-12-08T22:06:05Z\",\"labels\":{\"controller-revision-hash\":\"76b95c4db7\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"2b8e0db9-23c0-418d-a9ef-c094b7933355\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:06:05Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"2b8e0db9-23c0-418d-a9ef-c094b7933355\\\"}\":{}}},\"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-12-08T22:06:09Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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-87gzq\",\"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.22.17\",\"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-87gzq\",\"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.22-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.22-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-12-08T22:06:05Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:09Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:09Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:05Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:06:05Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:06:08Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-proxy:v1.22.17\",\"imageID\":\"docker.io/library/import-2022-12-08@sha256:f28f50eede5185779e035777087dc0f83e88bfede1f5cb16ae2f4462e2ac4029\",\"containerID\":\"containerd://a42afca6603841a04b634567393708ed1694f1c5053caaa70860d6d3560c484a\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.22-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"59c0bdbb-5af9-49af-b642-d14f9562eb92\",\"resourceVersion\":\"489\",\"creationTimestamp\":\"2022-12-08T22:05:44Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"151a6aa3c7909337dd268818251a3aa7\",\"kubernetes.io/config.mirror\":\"151a6aa3c7909337dd268818251a3aa7\",\"kubernetes.io/config.seen\":\"2022-12-08T22:05:34.617595618Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.22-control-plane\",\"uid\":\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:05:44Z\",\"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\\\":\\\"6b2bbd18-c6c8-4632-855d-9fd25a7b3bb8\\\"}\":{}}},\"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-12-08T22:06:06Z\",\"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.24.0.3\\\"}\":{\".\":{},\"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.22.17\",\"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\",\"--port=0\"],\"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.22-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-12-08T22:05:57Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:06Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:06:06Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:05:57Z\"}],\"hostIP\":\"172.24.0.3\",\"podIP\":\"172.24.0.3\",\"podIPs\":[{\"ip\":\"172.24.0.3\"}],\"startTime\":\"2022-12-08T22:05:57Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2022-12-08T22:05:38Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-scheduler:v1.22.17\",\"imageID\":\"docker.io/library/import-2022-12-08@sha256:ccbb84d130c6d762c14ef1bc581b5a885b7861fbdf8e688ec3dc87f74a1a1bfe\",\"containerID\":\"containerd://0ce2dec5c67e5ecc8ebca566b4ac68df95406870508bd6308cb8e5d64cd976e5\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" - }, - { - "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.22-control-plane/log?&container=kube-apiserver", - "request_method": "GET", - "request_body": "", - "request_content_type": null, - "response_status_code": 200, - "response_body": "I1208 22:05:38.724724 1 server.go:553] external host was not specified, using 172.24.0.3\nI1208 22:05:38.725092 1 server.go:161] Version: v1.22.17\nI1208 22:05:39.071240 1 shared_informer.go:240] Waiting for caches to sync for node_authorizer\nI1208 22:05:39.072275 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.\nI1208 22:05:39.072290 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.\nI1208 22:05:39.073062 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.\nI1208 22:05:39.073071 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.\nW1208 22:05:39.074710 1 clientconn.go:1326] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW1208 22:05:40.119590 1 genericapiserver.go:455] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI1208 22:05:40.120443 1 instance.go:278] Using reconciler: lease\nI1208 22:05:40.267777 1 rest.go:130] the default service ipfamily for this cluster is: IPv4\nW1208 22:05:41.014152 1 genericapiserver.go:455] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.016735 1 genericapiserver.go:455] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.036340 1 genericapiserver.go:455] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.040441 1 genericapiserver.go:455] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.049904 1 genericapiserver.go:455] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.054605 1 genericapiserver.go:455] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW1208 22:05:41.064169 1 genericapiserver.go:455] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.064190 1 genericapiserver.go:455] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW1208 22:05:41.065488 1 genericapiserver.go:455] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW1208 22:05:41.065496 1 genericapiserver.go:455] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW1208 22:05:41.068834 1 genericapiserver.go:455] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW1208 22:05:41.070674 1 genericapiserver.go:455] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW1208 22:05:41.083900 1 genericapiserver.go:455] Skipping API apps/v1beta2 because it has no resources.\nW1208 22:05:41.083918 1 genericapiserver.go:455] Skipping API apps/v1beta1 because it has no resources.\nW1208 22:05:41.086495 1 genericapiserver.go:455] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nI1208 22:05:41.091329 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.\nI1208 22:05:41.091343 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.\nW1208 22:05:41.112830 1 genericapiserver.go:455] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI1208 22:05:42.105153 1 dynamic_cafile_content.go:155] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI1208 22:05:42.105181 1 dynamic_cafile_content.go:155] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI1208 22:05:42.105362 1 dynamic_serving_content.go:129] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI1208 22:05:42.105617 1 secure_serving.go:266] Serving securely on [::]:6443\nI1208 22:05:42.105651 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI1208 22:05:42.105693 1 autoregister_controller.go:141] Starting autoregister controller\nI1208 22:05:42.105706 1 cache.go:32] Waiting for caches to sync for autoregister controller\nI1208 22:05:42.105754 1 crdregistration_controller.go:111] Starting crd-autoregister controller\nI1208 22:05:42.105777 1 shared_informer.go:240] Waiting for caches to sync for crd-autoregister\nI1208 22:05:42.106113 1 customresource_discovery_controller.go:209] Starting DiscoveryController\nI1208 22:05:42.106230 1 apf_controller.go:312] Starting API Priority and Fairness config controller\nI1208 22:05:42.106317 1 dynami" - } -] 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 5493e403da..3edd111fc8 100644 --- a/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-22/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"6827cd25-9dda-4362-97a0-914f393ff26e\",\"resourceVersion\":\"816\",\"generation\":1,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"6827cd25-9dda-4362-97a0-914f393ff26e\",\"resourceVersion\":\"818\",\"generation\":2,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"6827cd25-9dda-4362-97a0-914f393ff26e\",\"resourceVersion\":\"822\",\"generation\":3,\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2022-12-08T22:09:57Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"6827cd25-9dda-4362-97a0-914f393ff26e\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"847\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-xb58n\",\"generateName\":\"k8s-openapi-tests-patch-deployment-74dfc8d469-\",\"namespace\":\"default\",\"uid\":\"c0d57f63-a0e3-4b07-8274-fe15358823b5\",\"resourceVersion\":\"843\",\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"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\":\"c30b5b0e-1f82-48a4-b017-4b6e38b182ef\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:09:57Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c30b5b0e-1f82-48a4-b017-4b6e38b182ef\\\"}\":{}}},\"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-12-08T22:09:57Z\",\"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-n7fpf\",\"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-n7fpf\",\"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.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\":\"Pending\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\"}],\"hostIP\":\"172.24.0.3\",\"startTime\":\"2022-12-08T22:09:57Z\",\"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-857c4f8567-z4zjd\",\"generateName\":\"k8s-openapi-tests-patch-deployment-857c4f8567-\",\"namespace\":\"default\",\"uid\":\"313a1368-ae47-49c6-83f4-5a659bcb1b59\",\"resourceVersion\":\"837\",\"creationTimestamp\":\"2022-12-08T22:09:57Z\",\"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\":\"b80064de-6fc7-4513-833d-69760f0c2449\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2022-12-08T22:09:57Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"b80064de-6fc7-4513-833d-69760f0c2449\\\"}\":{}}},\"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-frlhx\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.8\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-frlhx\",\"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.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\":\"Pending\",\"conditions\":[{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2022-12-08T22:09:57Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-22/pod-list.json b/k8s-openapi-tests/test-replays/v1-22/pod-list.json index 619dad768b..c034312091 100644 --- a/k8s-openapi-tests/test-replays/v1-22/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-22/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-23/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-23/api_versions-list.json index f438cd3794..37bd05acde 100644 --- a/k8s-openapi-tests/test-replays/v1-23/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-23/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, 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 58885ce6ad..2ff3cddab2 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 @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -32,7 +32,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2023-02-28T23:32:20Z\",\"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\":\"2023-02-28T23:32:20Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"674\",\"uid\":\"462082a5-1d28-480e-852b-5d95ffe0476e\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -59,7 +59,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"462082a5-1d28-480e-852b-5d95ffe0476e\"}}\n" }, @@ -83,7 +83,7 @@ "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", + "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\":\"3480cd5e-b4a0-42bc-b966-ef46a9f56512\",\"resourceVersion\":\"676\",\"generation\":1,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"deletionTimestamp\":\"2023-02-28T23:32:20Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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\":\"2023-02-28T23:32:18Z\",\"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\":\"2023-02-28T23:32:18Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2023-02-28T23:32:18Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2023-02-28T23:32:20Z\",\"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/deployment-list.json b/k8s-openapi-tests/test-replays/v1-23/deployment-list.json index fd9c16da36..f9cadd32f2 100644 --- a/k8s-openapi-tests/test-replays/v1-23/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-23/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, 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 55580c2073..60e3e32bda 100644 --- a/k8s-openapi-tests/test-replays/v1-23/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-23/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -104,7 +104,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"resourceVersion\":\"730\",\"generation\":1,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"labels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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\":\"2023-02-28T23:32:29Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"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\":\"2023-02-28T23:32:29Z\",\"lastTransitionTime\":\"2023-02-28T23:32:29Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-02-28T23:32:18Z\",\"failed\":1}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -115,7 +115,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"resourceVersion\":\"732\",\"generation\":2,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"deletionTimestamp\":\"2023-02-28T23:32:30Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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\":\"2023-02-28T23:32:29Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"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\":\"2023-02-28T23:32:29Z\",\"lastTransitionTime\":\"2023-02-28T23:32:29Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-02-28T23:32:18Z\",\"failed\":1}}\n" }, @@ -123,7 +123,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"732\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-mtc82\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"fc2c609b-69fe-4a89-9826-86c39324ad73\",\"resourceVersion\":\"728\",\"creationTimestamp\":\"2023-02-28T23:32:19Z\",\"labels\":{\"controller-uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:32:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"18d31aef-0b6e-4bd7-8be4-f38d0b1cbe4f\\\"}\":{}}},\"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\":\"2023-02-28T23:32:29Z\",\"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-v8hk9\",\"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-v8hk9\",\"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\":\"2023-02-28T23:32:19Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:32:19Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:32:19Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:32:19Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"10.244.0.8\",\"podIPs\":[{\"ip\":\"10.244.0.8\"}],\"startTime\":\"2023-02-28T23:32:19Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2023-02-28T23:32:26Z\",\"finishedAt\":\"2023-02-28T23:32:26Z\",\"containerID\":\"containerd://4e84cb07d35ac594077d9a9b0576f79dedcdff16caa6518859598650e206747a\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:69665d02cb32192e52e07644d76bc6f25abeb5410edc1c7a81a10ba3f0efb90a\",\"containerID\":\"containerd://4e84cb07d35ac594077d9a9b0576f79dedcdff16caa6518859598650e206747a\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-23/logs-get.json b/k8s-openapi-tests/test-replays/v1-23/logs-get.json deleted file mode 100644 index 3e7a9ca267..0000000000 --- a/k8s-openapi-tests/test-replays/v1-23/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"619\"},\"items\":[{\"metadata\":{\"name\":\"coredns-bd6b6df9f-9bqpj\",\"generateName\":\"coredns-bd6b6df9f-\",\"namespace\":\"kube-system\",\"uid\":\"f338fd72-9996-4f69-89da-dcc1bfb89b34\",\"resourceVersion\":\"532\",\"creationTimestamp\":\"2023-02-28T23:30:58Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"bd6b6df9f\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-bd6b6df9f\",\"uid\":\"3579a712-3460-48ff-aeb1-8d1e16d68124\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:58Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"3579a712-3460-48ff-aeb1-8d1e16d68124\\\"}\":{}}},\"f:spec\":{\"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\":\"2023-02-28T23:30:58Z\",\"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\":\"2023-02-28T23:31: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\\\":\\\"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-6djrd\",\"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.8.6\",\"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-6djrd\",\"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.23-control-plane\",\"securityContext\":{},\"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\":\"2023-02-28T23:31:10Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:10Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2023-02-28T23:31:10Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:31:11Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.6\",\"imageID\":\"sha256:a4ca41631cc7ac19ce1be3ebf0314ac5f47af7c711f17066006db82ee3b75b03\",\"containerID\":\"containerd://d1e8aa2bac279833c0ce8d65e28ca1cc8c1f4866a5f266efe82be1cb506557d5\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-bd6b6df9f-thjf5\",\"generateName\":\"coredns-bd6b6df9f-\",\"namespace\":\"kube-system\",\"uid\":\"2ccbd311-be3e-4370-88ac-9758b5ad50ce\",\"resourceVersion\":\"524\",\"creationTimestamp\":\"2023-02-28T23:30:58Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"bd6b6df9f\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-bd6b6df9f\",\"uid\":\"3579a712-3460-48ff-aeb1-8d1e16d68124\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:58Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"3579a712-3460-48ff-aeb1-8d1e16d68124\\\"}\":{}}},\"f:spec\":{\"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\":\"2023-02-28T23:30:58Z\",\"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\":\"2023-02-28T23:31: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\\\":\\\"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-s2c27\",\"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.8.6\",\"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-s2c27\",\"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.23-control-plane\",\"securityContext\":{},\"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\":\"2023-02-28T23:31:10Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:10Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2023-02-28T23:31:10Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:31:11Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.6\",\"imageID\":\"sha256:a4ca41631cc7ac19ce1be3ebf0314ac5f47af7c711f17066006db82ee3b75b03\",\"containerID\":\"containerd://4f01b2d137bb2a07f0c4c7c2c3197e17fe6c0e525dc27965e5ef401724bbc727\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.23-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"0d31bb5e-cae2-4d81-9cdc-fdcb6b86438d\",\"resourceVersion\":\"484\",\"creationTimestamp\":\"2023-02-28T23:30:50Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.24.0.5:2379\",\"kubernetes.io/config.hash\":\"7a13617a977a08a50602b793d83522a9\",\"kubernetes.io/config.mirror\":\"7a13617a977a08a50602b793d83522a9\",\"kubernetes.io/config.seen\":\"2023-02-28T23:30:49.965799879Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.23-control-plane\",\"uid\":\"6d274cd4-ad51-4f90-8361-cd96528727c8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:50Z\",\"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\\\":\\\"6d274cd4-ad51-4f90-8361-cd96528727c8\\\"}\":{}}},\"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\":\"2023-02-28T23:31:01Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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.6-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.24.0.5:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--initial-advertise-peer-urls=https://172.24.0.5:2380\",\"--initial-cluster=v1.23-control-plane=https://172.24.0.5:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.24.0.5:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.24.0.5:2380\",\"--name=v1.23-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\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health\",\"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.23-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\":\"2023-02-28T23:30:50Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:01Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:01Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:50Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:50Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:30:37Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.6-0\",\"imageID\":\"sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7\",\"containerID\":\"containerd://1d1c1873043c0ca95d382060d17bdc7ae4480c3af6006a24636fcd67754ce958\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-s5jb9\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"c659cc0b-14e7-412e-9879-aac719824cb4\",\"resourceVersion\":\"486\",\"creationTimestamp\":\"2023-02-28T23:30:58Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"58b974ccd\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"ef666f32-e9ec-4838-af71-cec03efcac50\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:58Z\",\"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\\\":\\\"ef666f32-e9ec-4838-af71-cec03efcac50\\\"}\":{}}},\"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\":\"2023-02-28T23:31:02Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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-cj8g2\",\"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:v20221004-44d545d1\",\"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.23-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-cj8g2\",\"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.23-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.23-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\":\"2023-02-28T23:30:58Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:02Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:02Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:58Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:58Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:31:01Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20221004-44d545d1\",\"imageID\":\"sha256:d6e3e26021b60c625f0ef5b2dd3f9e22d2d398e05bccc4fdd7d59fbbb6a04d3f\",\"containerID\":\"containerd://1a64eef8f85cf9c347674f53f5136576060eb44ce3de635518a32546ed1a17c9\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.23-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"65868635-939c-4811-ace5-c5f4cffdd972\",\"resourceVersion\":\"471\",\"creationTimestamp\":\"2023-02-28T23:30:50Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.24.0.5:6443\",\"kubernetes.io/config.hash\":\"412489d55c2884c7293daecf2f3df8c8\",\"kubernetes.io/config.mirror\":\"412489d55c2884c7293daecf2f3df8c8\",\"kubernetes.io/config.seen\":\"2023-02-28T23:30:49.965804518Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.23-control-plane\",\"uid\":\"6d274cd4-ad51-4f90-8361-cd96528727c8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:50Z\",\"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\\\":\\\"6d274cd4-ad51-4f90-8361-cd96528727c8\\\"}\":{}}},\"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\":\"2023-02-28T23:30:59Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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.23.17\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.24.0.5\",\"--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.24.0.5\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.24.0.5\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.24.0.5\",\"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.23-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\":\"2023-02-28T23:30:51Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:59Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:59Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:51Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:51Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:30:30Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-apiserver:v1.23.17\",\"imageID\":\"docker.io/library/import-2023-02-28@sha256:3535fa289721c186a7147aa372a0f7ef557620d38d0d4285c33f57c482366980\",\"containerID\":\"containerd://8f3f469b1b665b60ac483ed2f657ab98fda1bc1e1704a5de2690682f4dd6cf72\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.23-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"ad26ef29-4891-48c5-853d-a0e6624aa890\",\"resourceVersion\":\"383\",\"creationTimestamp\":\"2023-02-28T23:30:50Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"3a07e0c07090d5dbe9fe496bd620d078\",\"kubernetes.io/config.mirror\":\"3a07e0c07090d5dbe9fe496bd620d078\",\"kubernetes.io/config.seen\":\"2023-02-28T23:30:49.965806081Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.23-control-plane\",\"uid\":\"6d274cd4-ad51-4f90-8361-cd96528727c8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:50Z\",\"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\\\":\\\"6d274cd4-ad51-4f90-8361-cd96528727c8\\\"}\":{}}},\"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\":\"2023-02-28T23:30:54Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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.23.17\",\"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.23\",\"--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.23-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\":\"2023-02-28T23:30:50Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:52Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:52Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:50Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:50Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:30:30Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-controller-manager:v1.23.17\",\"imageID\":\"docker.io/library/import-2023-02-28@sha256:750284d445ee782145dbca8b677339b5dc165e1464ad4e362e97a5bc98c1be39\",\"containerID\":\"containerd://fdda28081e8a15c8ebc8ce2f2eee7cd1d6a54d719c41170b57e948e1f8582067\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-5rbg2\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"df711f98-fc32-411f-ba2c-45e9151fe177\",\"resourceVersion\":\"482\",\"creationTimestamp\":\"2023-02-28T23:30:58Z\",\"labels\":{\"controller-revision-hash\":\"5cc54fc4b6\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"a4f35053-b43e-4daa-af4b-2339417aa5f9\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:58Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a4f35053-b43e-4daa-af4b-2339417aa5f9\\\"}\":{}}},\"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\":\"2023-02-28T23:31:01Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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-2ttlz\",\"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.23.17\",\"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-2ttlz\",\"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.23-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.23-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\":\"2023-02-28T23:30:58Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:01Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:31:01Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:58Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:58Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:31:00Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-proxy:v1.23.17\",\"imageID\":\"docker.io/library/import-2023-02-28@sha256:12c602c02b0eaa675b16ab23aa278946ee62c903ffd00cb80267b4d87b8cb48a\",\"containerID\":\"containerd://38caa415a8f9f7bc54e39e9b590b900f76ff2349685809974000d9ef8addb6a6\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.23-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"403ed766-9d3e-482f-a44a-0399c0bab03e\",\"resourceVersion\":\"388\",\"creationTimestamp\":\"2023-02-28T23:30:50Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"04b8865f9a0fa298a7c8da59fdd589e4\",\"kubernetes.io/config.mirror\":\"04b8865f9a0fa298a7c8da59fdd589e4\",\"kubernetes.io/config.seen\":\"2023-02-28T23:30:49.965807193Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.23-control-plane\",\"uid\":\"6d274cd4-ad51-4f90-8361-cd96528727c8\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:30:50Z\",\"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\\\":\\\"6d274cd4-ad51-4f90-8361-cd96528727c8\\\"}\":{}}},\"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\":\"2023-02-28T23:30:58Z\",\"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.24.0.5\\\"}\":{\".\":{},\"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.23.17\",\"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.23-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\":\"2023-02-28T23:30:51Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:58Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:58Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:30:51Z\"}],\"hostIP\":\"172.24.0.5\",\"podIP\":\"172.24.0.5\",\"podIPs\":[{\"ip\":\"172.24.0.5\"}],\"startTime\":\"2023-02-28T23:30:51Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2023-02-28T23:30:29Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"k8s.gcr.io/kube-scheduler:v1.23.17\",\"imageID\":\"docker.io/library/import-2023-02-28@sha256:400893aabb49491d303a4ba7379bfb2b3ec7eb5e5ffd08506439f245dee8c822\",\"containerID\":\"containerd://4046abee89650c252d2b157a43f00e15c5f385a96825511865b890fd9f4795fc\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" - }, - { - "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.23-control-plane/log?&container=kube-apiserver", - "request_method": "GET", - "request_body": "", - "request_content_type": null, - "response_status_code": 200, - "response_body": "I0228 23:30:30.338703 1 server.go:565] external host was not specified, using 172.24.0.5\nI0228 23:30:30.339374 1 server.go:172] Version: v1.23.17\nI0228 23:30:30.617246 1 shared_informer.go:240] Waiting for caches to sync for node_authorizer\nI0228 23:30:30.618200 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.\nI0228 23:30:30.618220 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.\nI0228 23:30:30.619157 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.\nI0228 23:30:30.619175 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.\nW0228 23:30:30.622638 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:31.618384 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:31.623801 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:32.619118 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:33.481872 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:34.000002 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:35.834362 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:36.331391 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0228 23:30:39.787581 1 genericapiserver.go:538] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0228 23:30:39.788761 1 instance.go:274] Using reconciler: lease\nW0228 23:30:40.526692 1 genericapiserver.go:538] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.529297 1 genericapiserver.go:538] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.550518 1 genericapiserver.go:538] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.553013 1 genericapiserver.go:538] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.566068 1 genericapiserver.go:538] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.569249 1 genericapiserver.go:538] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW0228 23:30:40.575594 1 genericapiserver.go:538] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.575610 1 genericapiserver.go:538] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW0228 23:30:40.576987 1 genericapiserver.go:538] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0228 23:30:40.576996 1 genericapiserver.go:538] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW0228 23:30:40.581472 1 genericapiserver.go:538] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW0228 23:30:40.585598 1 genericapiserver.go:538] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW0228 23:30:40.589245 1 genericapiserver.go:538] Skipping API apps/v1beta2 because it has no resources.\nW0228 23:30:40.589263 1 genericapiserver.go:538] Skipping API apps/v1beta1 because it has no resources.\nW0228 23:30:40.591227 1 genericapiserver.go:538] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nI0228 23:30:40.600440 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.\nI0228 23:30:40.600475 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.\nW0228 23:30:40.642507 1 genericapiserver.go:538] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0228 23:30:41.716977 1 dynamic_cafile_content.go:156] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0228 23:30:41.717019 1 dynamic_cafile_content.go:156] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0228 23:30:41.717107 1 dynamic_serving_content.go:131] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0228 23:30:41.717425 1 secure_serving.go:267] Serving securely on [::]:6443\nI0228 23:30:41.717495 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0228 23:30:41.717624 1 available_controller.go:491] Starting AvailableConditionController\nI0228 23:30:41.717642 1 cache.go:32] Waiting for caches to sync for AvailableConditionController controller\nI0228 23:30:41.717634 1 controller.go:83] Starting OpenAPI AggregationController\nI0228 23:30:41.717677 1 controller.go:85] Starting OpenAPI controller\nI0228 23:30:41.717718 1 naming_controller.go:291] Starting NamingConditionController\nI0228 23:30:41.717667 1 apiservice_controller.go:97] Starting APIServiceRegistrationController\nI0228 23:30:41.717744 1 cache.go:32] Waiting for caches to sync for APIServiceRegistrationController controller\nI0228 23:30:41.717724 1 customresource_discovery_controller.go:209] Starting Discove" - } -] 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 aebbaeef1e..33e967dca9 100644 --- a/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-23/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"01b9e0bb-3dc5-41d6-bd9c-07aed8931e70\",\"resourceVersion\":\"621\",\"generation\":1,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"01b9e0bb-3dc5-41d6-bd9c-07aed8931e70\",\"resourceVersion\":\"624\",\"generation\":2,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"01b9e0bb-3dc5-41d6-bd9c-07aed8931e70\",\"resourceVersion\":\"626\",\"generation\":3,\"creationTimestamp\":\"2023-02-28T23:32:18Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-02-28T23:32:18Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"01b9e0bb-3dc5-41d6-bd9c-07aed8931e70\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"649\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-5c6c56699-j7tjk\",\"generateName\":\"k8s-openapi-tests-patch-deployment-5c6c56699-\",\"namespace\":\"default\",\"uid\":\"4e8a5714-def5-4ce7-a960-cfe1d50a2ea3\",\"resourceVersion\":\"634\",\"creationTimestamp\":\"2023-02-28T23:32:19Z\",\"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\":\"a30a3a6b-514f-4deb-9da6-1f10c3b98921\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:32:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a30a3a6b-514f-4deb-9da6-1f10c3b98921\\\"}\":{}}},\"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-wmjvr\",\"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-wmjvr\",\"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.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\":\"Pending\",\"conditions\":[{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:32:19Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-b7fccbd49-9hcqs\",\"generateName\":\"k8s-openapi-tests-patch-deployment-b7fccbd49-\",\"namespace\":\"default\",\"uid\":\"89f98f25-01d0-4eb7-ac23-e9f01dfc0f51\",\"resourceVersion\":\"646\",\"creationTimestamp\":\"2023-02-28T23:32:19Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"b7fccbd49\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-b7fccbd49\",\"uid\":\"958bdcd5-7e93-4ffb-a542-c8f293b3846f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-02-28T23:32:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"958bdcd5-7e93-4ffb-a542-c8f293b3846f\\\"}\":{}}},\"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-kpmlh\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.8\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-kpmlh\",\"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.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\":\"Pending\",\"conditions\":[{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-02-28T23:32:19Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-23/pod-list.json b/k8s-openapi-tests/test-replays/v1-23/pod-list.json index cc9de25442..c71e59df3a 100644 --- a/k8s-openapi-tests/test-replays/v1-23/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-23/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-24/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-24/api_versions-list.json index f438cd3794..37bd05acde 100644 --- a/k8s-openapi-tests/test-replays/v1-24/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-24/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, 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 f03465232b..d759afaf13 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 @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -24,7 +24,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2023-08-24T04:08:14Z\",\"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\":\"2023-08-24T04:08:14Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"574\",\"uid\":\"70558793-479d-469e-82db-19413a949747\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -51,7 +51,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"70558793-479d-469e-82db-19413a949747\"}}\n" }, @@ -75,7 +75,7 @@ "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", + "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\":\"3b1356de-7c6e-4e6d-a3a1-8bbee7c203c5\",\"resourceVersion\":\"577\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"deletionTimestamp\":\"2023-08-24T04:08:15Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:12Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T04:08:15Z\",\"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/deployment-list.json b/k8s-openapi-tests/test-replays/v1-24/deployment-list.json index b9d39d9bf9..d390f9f2e5 100644 --- a/k8s-openapi-tests/test-replays/v1-24/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-24/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, 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 722a02a778..19d44eeaa9 100644 --- a/k8s-openapi-tests/test-replays/v1-24/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-24/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -120,7 +120,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"resourceVersion\":\"621\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"labels\":{\"controller-uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:25Z\",\"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\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"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\":\"2023-08-24T04:08:25Z\",\"lastTransitionTime\":\"2023-08-24T04:08:25Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"failed\":1,\"ready\":0}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -131,7 +131,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"resourceVersion\":\"625\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"deletionTimestamp\":\"2023-08-24T04:08:25Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:25Z\",\"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\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"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\":\"2023-08-24T04:08:25Z\",\"lastTransitionTime\":\"2023-08-24T04:08:25Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"failed\":1,\"ready\":0}}\n" }, @@ -139,7 +139,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"625\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-v8djn\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"0b75286f-e879-4ae4-af63-81e732fe0de0\",\"resourceVersion\":\"615\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"labels\":{\"controller-uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"98e46241-68d1-4436-ace8-a95bc5ab0552\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"98e46241-68d1-4436-ace8-a95bc5ab0552\\\"}\":{}}},\"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\":\"2023-08-24T04:08:24Z\",\"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-csqn5\",\"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-csqn5\",\"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\":\"2023-08-24T04:08:12Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.7\",\"podIPs\":[{\"ip\":\"10.244.0.7\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2023-08-24T04:08:22Z\",\"finishedAt\":\"2023-08-24T04:08:22Z\",\"containerID\":\"containerd://675dacd687007264a703269b4518dbbbee9904a7ac129af4c06033078f967cb1\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a\",\"containerID\":\"containerd://675dacd687007264a703269b4518dbbbee9904a7ac129af4c06033078f967cb1\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-24/logs-get.json b/k8s-openapi-tests/test-replays/v1-24/logs-get.json deleted file mode 100644 index edd5967628..0000000000 --- a/k8s-openapi-tests/test-replays/v1-24/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"511\"},\"items\":[{\"metadata\":{\"name\":\"coredns-57575c5f89-58vf2\",\"generateName\":\"coredns-57575c5f89-\",\"namespace\":\"kube-system\",\"uid\":\"8ecd13df-71aa-4756-9b79-49be7085de38\",\"resourceVersion\":\"440\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"57575c5f89\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-57575c5f89\",\"uid\":\"94261658-2495-47cf-ae2c-85af868d17e5\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"94261658-2495-47cf-ae2c-85af868d17e5\\\"}\":{}}},\"f:spec\":{\"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\":\"2023-08-24T04:07:13Z\",\"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\":\"2023-08-24T04:07: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\\\":\\\"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-46qmz\",\"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.8.6\",\"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-46qmz\",\"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.24-control-plane\",\"securityContext\":{},\"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\":\"2023-08-24T04:07:21Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:21Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2023-08-24T04:07:21Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:22Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.6\",\"imageID\":\"sha256:a4ca41631cc7ac19ce1be3ebf0314ac5f47af7c711f17066006db82ee3b75b03\",\"containerID\":\"containerd://940d5d78b8958f8bbbb2fb26d3f433a22686cc3a2ce7536f6bc424020faa7091\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-57575c5f89-cwv5z\",\"generateName\":\"coredns-57575c5f89-\",\"namespace\":\"kube-system\",\"uid\":\"f6aaee7e-a10b-468e-98d2-b8a16be764a8\",\"resourceVersion\":\"448\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"57575c5f89\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-57575c5f89\",\"uid\":\"94261658-2495-47cf-ae2c-85af868d17e5\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"94261658-2495-47cf-ae2c-85af868d17e5\\\"}\":{}}},\"f:spec\":{\"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\":\"2023-08-24T04:07:13Z\",\"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\":\"2023-08-24T04:07: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\\\":\\\"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-zfs2j\",\"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.8.6\",\"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-zfs2j\",\"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.24-control-plane\",\"securityContext\":{},\"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\":\"2023-08-24T04:07:21Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:21Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2023-08-24T04:07:21Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:22Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.8.6\",\"imageID\":\"sha256:a4ca41631cc7ac19ce1be3ebf0314ac5f47af7c711f17066006db82ee3b75b03\",\"containerID\":\"containerd://c5965762c1c50a842dcc308d4643b583a1dc6ad564f8a1adca3a28c19d8e003f\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.24-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"d92787b9-3ac1-4d46-a269-f56af8118e96\",\"resourceVersion\":\"304\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.23.0.3:2379\",\"kubernetes.io/config.hash\":\"a03dd2e46154c5465ada123db6ab5913\",\"kubernetes.io/config.mirror\":\"a03dd2e46154c5465ada123db6ab5913\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.081846236Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.24-control-plane\",\"uid\":\"73d8719a-22a2-4a29-8af7-e9866082e468\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"73d8719a-22a2-4a29-8af7-e9866082e468\\\"}\":{}}},\"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\":\"2023-08-24T04:07:08Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.6-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.23.0.3:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--initial-advertise-peer-urls=https://172.23.0.3:2380\",\"--initial-cluster=v1.24-control-plane=https://172.23.0.3:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.23.0.3:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.23.0.3:2380\",\"--name=v1.24-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\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health\",\"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.24-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\":\"2023-08-24T04:07:02Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:08Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:08Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:02Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:02Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:51Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.6-0\",\"imageID\":\"sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7\",\"containerID\":\"containerd://d13e500ea0dabc799449adcdf70caa107a2e3479ff3adf9f3734ddef8415775d\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-76n6l\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"6423d1db-1596-4c5a-9a04-12c16a80c9e4\",\"resourceVersion\":\"403\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"76dc5977cc\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"1b2f3586-31ec-4414-9de1-208b9e7a25ed\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"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\\\":\\\"1b2f3586-31ec-4414-9de1-208b9e7a25ed\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:17Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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-lffmb\",\"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:v20230511-dc714da8\",\"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.24-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-lffmb\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.24-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.24-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\":\"2023-08-24T04:07:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:17Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:17Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:13Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:16Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20230511-dc714da8\",\"imageID\":\"sha256:b0b1fa0f58c6e932b7f20bf208b2841317a1e8c88cc51b18358310bbd8ec95da\",\"containerID\":\"containerd://11b05149c98381bd38e148e1be97bd97a48c4a3743a9c20a261d8e64c6b9ab31\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.24-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"5f1ffaa8-8a54-4870-bcc3-fa9aa678a692\",\"resourceVersion\":\"309\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.23.0.3:6443\",\"kubernetes.io/config.hash\":\"d1810e37334f8b0aa1f2b681c33f85cd\",\"kubernetes.io/config.mirror\":\"d1810e37334f8b0aa1f2b681c33f85cd\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.081847539Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.24-control-plane\",\"uid\":\"73d8719a-22a2-4a29-8af7-e9866082e468\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"73d8719a-22a2-4a29-8af7-e9866082e468\\\"}\":{}}},\"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\":\"2023-08-24T04:07:09Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.24.17\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.23.0.3\",\"--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.23.0.3\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.23.0.3\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.23.0.3\",\"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.24-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\":\"2023-08-24T04:07:02Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:09Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:09Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:02Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:02Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.24.17\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:ae1074d3328a77efe73f6e124df9476c3dacf8dd835a6fb9ffd42a370e039283\",\"containerID\":\"containerd://3bc65c8b0abd1ef76729aaead746bf7a9e08d065cbf0eb2da17e32dfd955a4be\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.24-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"f19c225e-49d5-4920-b81e-0398a175880f\",\"resourceVersion\":\"301\",\"creationTimestamp\":\"2023-08-24T04:06:59Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"2b3539b06ce5d878537d075e4786ea38\",\"kubernetes.io/config.mirror\":\"2b3539b06ce5d878537d075e4786ea38\",\"kubernetes.io/config.seen\":\"2023-08-24T04:06:43.700495516Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.24-control-plane\",\"uid\":\"73d8719a-22a2-4a29-8af7-e9866082e468\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:06:59Z\",\"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\\\":\\\"73d8719a-22a2-4a29-8af7-e9866082e468\\\"}\":{}}},\"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\":\"2023-08-24T04:07:07Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.24.17\",\"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.24\",\"--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.24-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\":\"2023-08-24T04:07:01Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:07Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:07Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:01Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:01Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.24.17\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:6399c0b33900bab1b7dd9e50c373e9e4227915e932ce87985724bcfef41b4e98\",\"containerID\":\"containerd://c5f22c05ae296c0cb67302eee8ae1e334c6f81b14bc93f01e6fe2b97cbeca785\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-bnrb2\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"28af4d19-ab68-4874-bd3f-9902aadfd710\",\"resourceVersion\":\"396\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"controller-revision-hash\":\"56fc79c4b9\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"bacf58cb-4a46-4ad4-b2d6-efe2319cd5f3\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"bacf58cb-4a46-4ad4-b2d6-efe2319cd5f3\\\"}\":{}}},\"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\":\"2023-08-24T04:07: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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.23.0.3\\\"}\":{\".\":{},\"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-zkf4z\",\"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.24.17\",\"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-zkf4z\",\"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.24-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.24-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\":\"2023-08-24T04:07:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:13Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:15Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.24.17\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:209893f9a33e6ce03fbd56f611138f8b1c442bc9e11887ade800f4a206b5f06a\",\"containerID\":\"containerd://242fe995ff63b92aa4ac6a04490cdf39365ec37f08ee41165e4024b7b6bfd186\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.24-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"8b1868ef-f5f5-46e2-9388-62df36dc12eb\",\"resourceVersion\":\"308\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"9a8a2e8eefa1edcb4f6d82f29f4e7d0a\",\"kubernetes.io/config.mirror\":\"9a8a2e8eefa1edcb4f6d82f29f4e7d0a\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.081835435Z\",\"kubernetes.io/config.source\":\"file\",\"seccomp.security.alpha.kubernetes.io/pod\":\"runtime/default\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.24-control-plane\",\"uid\":\"73d8719a-22a2-4a29-8af7-e9866082e468\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"73d8719a-22a2-4a29-8af7-e9866082e468\\\"}\":{}}},\"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\":\"2023-08-24T04:07:09Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.24.17\",\"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.24-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\":\"2023-08-24T04:07:01Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:09Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:09Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:01Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T04:07:01Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.24.17\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:a7a0477f36b4aabde4975c72d8d6253d9e39f89afafacaec177561c9cba54237\",\"containerID\":\"containerd://f82256aa979bcfb2b1b12f08362212a8e0cf1aa4c308096775fec20d666c7d9c\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" - }, - { - "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.24-control-plane/log?&container=kube-apiserver", - "request_method": "GET", - "request_body": "", - "request_content_type": null, - "response_status_code": 200, - "response_body": "I0824 04:06:50.470198 1 server.go:560] external host was not specified, using 172.23.0.3\nI0824 04:06:50.470889 1 server.go:159] Version: v1.24.17\nI0824 04:06:50.470917 1 server.go:161] \"Golang settings\" GOGC=\"\" GOMAXPROCS=\"\" GOTRACEBACK=\"\"\nI0824 04:06:50.880712 1 shared_informer.go:252] Waiting for caches to sync for node_authorizer\nI0824 04:06:50.881668 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.\nI0824 04:06:50.881680 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.\nI0824 04:06:50.882499 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.\nI0824 04:06:50.882509 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.\nW0824 04:06:50.884739 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1 0 }. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\". Reconnecting...\nW0824 04:06:52.213005 1 genericapiserver.go:557] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:52.213998 1 instance.go:274] Using reconciler: lease\nI0824 04:06:52.527837 1 instance.go:587] API group \"internal.apiserver.k8s.io\" is not enabled, skipping.\nW0824 04:06:53.181316 1 genericapiserver.go:557] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.182995 1 genericapiserver.go:557] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.206223 1 genericapiserver.go:557] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.208834 1 genericapiserver.go:557] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.222493 1 genericapiserver.go:557] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.227284 1 genericapiserver.go:557] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.236802 1 genericapiserver.go:557] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.236825 1 genericapiserver.go:557] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.239227 1 genericapiserver.go:557] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.239242 1 genericapiserver.go:557] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.246022 1 genericapiserver.go:557] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.252159 1 genericapiserver.go:557] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.258122 1 genericapiserver.go:557] Skipping API apps/v1beta2 because it has no resources.\nW0824 04:06:53.258139 1 genericapiserver.go:557] Skipping API apps/v1beta1 because it has no resources.\nW0824 04:06:53.260974 1 genericapiserver.go:557] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:53.266848 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.\nI0824 04:06:53.266872 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.\nW0824 04:06:53.292918 1 genericapiserver.go:557] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:54.508961 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0824 04:06:54.508992 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 04:06:54.509222 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0824 04:06:54.509820 1 secure_serving.go:210] Serving securely on [::]:6443\nI0824 04:06:54.509858 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0824 04:06:54.509990 1 aggregator.go:151] waiting for initial CRD sync...\nI0824 04:06:54.510020 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\"\nI0824 04:06:54.510084 1 apf_controller.go:317] Starting API Priority and Fairness config controller\nI0824 04:06:54.510185 1 customresource_discovery_controller.go:209] Starting DiscoveryController\nI0824 04:06:54.510267 1 nonstructuralschema_controller.go:192] Starting NonStructuralSchemaConditionController\nI0824 04:06:54.510300 1 apiapproval_controller.go:186] Starting KubernetesAPIApprovalPolicyConformantConditionController\nI0824 04:06:54.510327 1 crd_finalizer.go:266] Starting CRDFinalizer\nI0824 04:06:54.510359 1 establishing_controller.go:76] Starting EstablishingController\nI0824 04:06:54.510489 1 controller.go:83] Starting OpenAPI AggregationController\nI0824 04:06:54.510575 1 available_controller.go:491] Starting AvailableConditionController\nI0824 04:06:54.510591 1 cache.go:32] Waiting for caches to sync for AvailableConditionController controller\nI0824 04:06:54.510633 1 cluster_authentication_trust_controller.go:440] Starting cluster_authentication_trust_controller controller\nI0824 04:06:54.510640 1 apiservice_controller.go:97] Starting APIServiceRegistrationController\nI0824 04:06:54.510645 1 cache.go:32] Waiting for caches to sync for APIServiceRegistrationController controller\nI0824 04:06:54.510646 1 shared_informer.go:252] Waiting for caches to sync for cluster_authentication_trust_controller\nI0824 04:06:54.510784 1 controller.go:85] Starting OpenAPI controller\nI0824 04:06:54.510169 1 crdregistration_controller.go:111] Starting crd-autoregister controller\nI0824 04:06:54.510802 1 controller.go:80] Starting OpenAPI V3 AggregationController\nI0824 04:06:54.510823 1 controller.go:85] Starting OpenAPI V3 controller\nI0824 04:06:54.510826 1 shared_informer.go:252] Waiting for caches to sync for crd-autoregister\nI0824 04:06:54.510808 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 04:06:54.510867 1 naming_controller.go:291] Starting NamingConditionController\nI0824 04:06:54.511109 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0824 04:06:54.575173 1 controller.go:611] quota admission added eval" - } -] 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 cb83c60205..1f09d3c4f1 100644 --- a/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-24/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"1af8c6c6-b477-430d-9964-32862187e383\",\"resourceVersion\":\"512\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"1af8c6c6-b477-430d-9964-32862187e383\",\"resourceVersion\":\"514\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"1af8c6c6-b477-430d-9964-32862187e383\",\"resourceVersion\":\"519\",\"generation\":3,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"1af8c6c6-b477-430d-9964-32862187e383\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"540\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-7c6bd6bcc8-xmtzt\",\"generateName\":\"k8s-openapi-tests-patch-deployment-7c6bd6bcc8-\",\"namespace\":\"default\",\"uid\":\"c3744c71-9e50-4266-9b04-e5cb81887799\",\"resourceVersion\":\"534\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"7c6bd6bcc8\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-7c6bd6bcc8\",\"uid\":\"696b3e07-c3e3-49bf-9a59-99ca3acfff77\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"696b3e07-c3e3-49bf-9a59-99ca3acfff77\\\"}\":{}}},\"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-qgqjk\",\"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-qgqjk\",\"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\":\"2023-08-24T04:08:12Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-7c98d4f7d9-cmdgt\",\"generateName\":\"k8s-openapi-tests-patch-deployment-7c98d4f7d9-\",\"namespace\":\"default\",\"uid\":\"f70a9773-fb45-47fb-9c0f-3699991ece07\",\"resourceVersion\":\"528\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"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\":\"94405b0f-8c6c-48cc-9804-25d6d765e951\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"94405b0f-8c6c-48cc-9804-25d6d765e951\\\"}\":{}}},\"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-mthcx\",\"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-mthcx\",\"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\":\"2023-08-24T04:08:12Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-24/pod-list.json b/k8s-openapi-tests/test-replays/v1-24/pod-list.json index 27f803ba3e..c83152c6c3 100644 --- a/k8s-openapi-tests/test-replays/v1-24/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-24/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, 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 index b145040d5a..dee3ff47c8 100644 --- a/k8s-openapi-tests/test-replays/v1-25/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-25/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, 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 index 6655f942ca..eb6c878d07 100644 --- 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 @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -24,7 +24,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2023-08-24T04:08:14Z\",\"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\":\"2023-08-24T04:08:14Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"563\",\"uid\":\"e12a7717-a726-4991-a5f9-f039ccfc10ca\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -51,7 +51,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"e12a7717-a726-4991-a5f9-f039ccfc10ca\"}}\n" }, @@ -75,7 +75,7 @@ "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", + "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\":\"0ced0e7d-3fcd-4600-a68d-1463e69385fd\",\"resourceVersion\":\"567\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"deletionTimestamp\":\"2023-08-24T04:08:14Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:12Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T04:08:14Z\",\"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 index 8dde74577a..0927ff6c30 100644 --- a/k8s-openapi-tests/test-replays/v1-25/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-25/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-25/job-create.json b/k8s-openapi-tests/test-replays/v1-25/job-create.json index bf2f11e953..a878210ac1 100644 --- a/k8s-openapi-tests/test-replays/v1-25/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-25/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -128,7 +128,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"resourceVersion\":\"611\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"labels\":{\"controller-uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:26Z\",\"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\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"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\":\"2023-08-24T04:08:26Z\",\"lastTransitionTime\":\"2023-08-24T04:08:26Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -139,7 +139,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"resourceVersion\":\"613\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"deletionTimestamp\":\"2023-08-24T04:08:26Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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\":\"2023-08-24T04:08:26Z\",\"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\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"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\":\"2023-08-24T04:08:26Z\",\"lastTransitionTime\":\"2023-08-24T04:08:26Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, @@ -147,7 +147,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"613\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-jcs7p\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"b3481495-d875-4129-ad91-c939792f111f\",\"resourceVersion\":\"610\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"labels\":{\"controller-uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"ef943cc6-42e9-40b9-a312-c6eb82687b8e\\\"}\":{}}},\"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\":\"2023-08-24T04:08:25Z\",\"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-gxrkn\",\"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-gxrkn\",\"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\":\"2023-08-24T04:08:12Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:23Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:23Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.8\",\"podIPs\":[{\"ip\":\"10.244.0.8\"}],\"startTime\":\"2023-08-24T04:08:12Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2023-08-24T04:08:22Z\",\"finishedAt\":\"2023-08-24T04:08:22Z\",\"containerID\":\"containerd://bac935b045c516ee0efd58cadd9929c7aea3d09778fb6fd1b9c1cee702a665ff\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a\",\"containerID\":\"containerd://bac935b045c516ee0efd58cadd9929c7aea3d09778fb6fd1b9c1cee702a665ff\",\"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 deleted file mode 100644 index f141518c7b..0000000000 --- a/k8s-openapi-tests/test-replays/v1-25/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"506\"},\"items\":[{\"metadata\":{\"name\":\"coredns-565d847f94-b47fl\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"f40ae261-6414-4979-94f8-df697a175330\",\"resourceVersion\":\"444\",\"creationTimestamp\":\"2023-08-24T04:07:14Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"15459b70-a312-4fd3-b359-286553c90017\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"15459b70-a312-4fd3-b359-286553c90017\\\"}\":{}}},\"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\":\"2023-08-24T04:07:14Z\",\"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\":\"2023-08-24T04:07:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"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-zkkbd\",\"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-zkkbd\",\"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\":\"2023-08-24T04:07:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:21Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2023-08-24T04:07:22Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://5a2de15d0e11a8e49a76a1b1b155d50d08f65c59939616ecd133de82c1b2c960\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-565d847f94-xwkwg\",\"generateName\":\"coredns-565d847f94-\",\"namespace\":\"kube-system\",\"uid\":\"9fa7e251-c1f5-472a-92cb-a1eb6aff780c\",\"resourceVersion\":\"433\",\"creationTimestamp\":\"2023-08-24T04:07:14Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"565d847f94\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-565d847f94\",\"uid\":\"15459b70-a312-4fd3-b359-286553c90017\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"15459b70-a312-4fd3-b359-286553c90017\\\"}\":{}}},\"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\":\"2023-08-24T04:07:14Z\",\"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\":\"2023-08-24T04:07: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\\\":\\\"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-krbpw\",\"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-krbpw\",\"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\":\"2023-08-24T04:07:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:23Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:21Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2023-08-24T04:07:22Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://ad1c2911605b83145d00eb0075186cdfde2bc207d5259d5a11cdb345d5d41450\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"6aa0a82f-24cd-481f-b6fe-e490d87e498e\",\"resourceVersion\":\"301\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.23.0.2:2379\",\"kubernetes.io/config.hash\":\"536c25f6fa7591a355634f2eed23494e\",\"kubernetes.io/config.mirror\":\"536c25f6fa7591a355634f2eed23494e\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.488899546Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"8c183523-60b8-48f0-965c-45cc3db76bb0\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"8c183523-60b8-48f0-965c-45cc3db76bb0\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:07Z\",\"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.23.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.6-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.23.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.23.0.2:2380\",\"--initial-cluster=v1.25-control-plane=https://172.23.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.23.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.23.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\":\"2023-08-24T04:07:02Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:07Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:07Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:02Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:02Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:51Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.6-0\",\"imageID\":\"sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7\",\"containerID\":\"containerd://87ff070b0ddc40c1bffd546bbd638c27e274f40ca02d0f667081bd74abc9f016\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-w8hwn\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"b5d40600-4813-426d-9565-5cd7ce3dbe2b\",\"resourceVersion\":\"399\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"68d68f7595\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"ad4f6ec4-bcaa-449d-8903-1a0bc4fcfaf0\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"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\\\":\\\"ad4f6ec4-bcaa-449d-8903-1a0bc4fcfaf0\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:16Z\",\"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.23.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-q7bpf\",\"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:v20230511-dc714da8\",\"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-q7bpf\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.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\":\"2023-08-24T04:07:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:16Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:16Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:13Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:13Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:16Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20230511-dc714da8\",\"imageID\":\"sha256:b0b1fa0f58c6e932b7f20bf208b2841317a1e8c88cc51b18358310bbd8ec95da\",\"containerID\":\"containerd://0405fd03ca1461e23414f6f57954cb5a8cea35847487434637a7e2800250e731\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"105d32db-3941-49a8-a368-9a129f2b2294\",\"resourceVersion\":\"305\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.23.0.2:6443\",\"kubernetes.io/config.hash\":\"c2c6df8781c664c2632d72a6ab3ccb74\",\"kubernetes.io/config.mirror\":\"c2c6df8781c664c2632d72a6ab3ccb74\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.488891640Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"8c183523-60b8-48f0-965c-45cc3db76bb0\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"8c183523-60b8-48f0-965c-45cc3db76bb0\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:08Z\",\"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.23.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.13\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.23.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.23.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.23.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.23.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\":\"2023-08-24T04:07:01Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:08Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:08Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:01Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:01Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.25.13\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:5a59411f03a06c63283004125f51d2623f01d8320c7fa1466e71e8cde03f7a1e\",\"containerID\":\"containerd://82c006c7ed589fa23bc511c1ffaec4be103806fb781bb14123620cedc69bc2fd\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"ac76f90d-d927-44aa-8f8e-f2243c96def2\",\"resourceVersion\":\"314\",\"creationTimestamp\":\"2023-08-24T04:07:01Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"925a5652de95528609e898563c0e9f72\",\"kubernetes.io/config.mirror\":\"925a5652de95528609e898563c0e9f72\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.488896910Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"8c183523-60b8-48f0-965c-45cc3db76bb0\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:01Z\",\"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\\\":\\\"8c183523-60b8-48f0-965c-45cc3db76bb0\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-controller-manager\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/controller-manager.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"flexvolume-dir\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07: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.23.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.13\",\"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\":\"2023-08-24T04:07:02Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:12Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:12Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:02Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:02Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.25.13\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:2d090f985e7781eaf93ea13f13fe61549b6454a547868f021ea34eb6fafa4be0\",\"containerID\":\"containerd://1f7d630a64ef463f7993fb6af4fedb178de7b679644c045a8c56fdeb9f1e81d3\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-zp8ln\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"2574ea5d-f962-4202-ab9f-c1cadc9f499d\",\"resourceVersion\":\"394\",\"creationTimestamp\":\"2023-08-24T04:07:13Z\",\"labels\":{\"controller-revision-hash\":\"766db5dff\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"b4ef26bf-fb62-4a43-9508-b32740d6923d\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:13Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"b4ef26bf-fb62-4a43-9508-b32740d6923d\\\"}\":{}}},\"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\":\"2023-08-24T04:07: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\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.23.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-pcfrl\",\"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.13\",\"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-pcfrl\",\"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\":\"2023-08-24T04:07:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:15Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:15Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:13Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:13Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:07:15Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.25.13\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:3e74b27ad781185a78beeb7a266111d9286f5e65edc7aeb2968eb290f75a1582\",\"containerID\":\"containerd://8a0d2a454b27b2db75ad670391cda00629b23bfcb6112022ddc215ba8c6264e9\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.25-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"a87bc7ca-74ae-4550-9e4b-7b2450c02a11\",\"resourceVersion\":\"299\",\"creationTimestamp\":\"2023-08-24T04:07:02Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"96a6eb6c84e007fff0718c8585ab5f07\",\"kubernetes.io/config.mirror\":\"96a6eb6c84e007fff0718c8585ab5f07\",\"kubernetes.io/config.seen\":\"2023-08-24T04:07:01.488898243Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.25-control-plane\",\"uid\":\"8c183523-60b8-48f0-965c-45cc3db76bb0\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:02Z\",\"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\\\":\\\"8c183523-60b8-48f0-965c-45cc3db76bb0\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-scheduler\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/scheduler.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:07:07Z\",\"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.23.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.13\",\"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\":\"2023-08-24T04:07:01Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:04Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:04Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:07:01Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T04:07:01Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T04:06:50Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.25.13\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:559de359daff9df6441d2156b0d96b5e2c5fea0010b0b0c1b4f557db1f96532b\",\"containerID\":\"containerd://b8f587558ff8b70a6fb6f4ac17346a6f918a851b8e2764de3792f39470e48dd7\",\"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": "I0824 04:06:50.805517 1 server.go:565] external host was not specified, using 172.23.0.2\nI0824 04:06:50.806207 1 server.go:162] Version: v1.25.13\nI0824 04:06:50.806243 1 server.go:164] \"Golang settings\" GOGC=\"\" GOMAXPROCS=\"\" GOTRACEBACK=\"\"\nI0824 04:06:50.991216 1 shared_informer.go:252] Waiting for caches to sync for node_authorizer\nI0824 04:06:50.992754 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.\nI0824 04:06:50.992774 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.\nI0824 04:06:50.993982 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.\nI0824 04:06:50.993995 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.\nW0824 04:06:50.996888 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\"\nW0824 04:06:52.288657 1 genericapiserver.go:656] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:52.290121 1 instance.go:261] Using reconciler: lease\nI0824 04:06:52.585151 1 instance.go:574] API group \"internal.apiserver.k8s.io\" is not enabled, skipping.\nW0824 04:06:53.165041 1 genericapiserver.go:656] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.167155 1 genericapiserver.go:656] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.173484 1 genericapiserver.go:656] Skipping API autoscaling/v2beta1 because it has no resources.\nW0824 04:06:53.180227 1 genericapiserver.go:656] Skipping API batch/v1beta1 because it has no resources.\nW0824 04:06:53.182357 1 genericapiserver.go:656] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.184133 1 genericapiserver.go:656] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.184175 1 genericapiserver.go:656] Skipping API discovery.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.188234 1 genericapiserver.go:656] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.188255 1 genericapiserver.go:656] Skipping API networking.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.189887 1 genericapiserver.go:656] Skipping API node.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.189900 1 genericapiserver.go:656] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.189938 1 genericapiserver.go:656] Skipping API policy/v1beta1 because it has no resources.\nW0824 04:06:53.195325 1 genericapiserver.go:656] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.195363 1 genericapiserver.go:656] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.198957 1 genericapiserver.go:656] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.198979 1 genericapiserver.go:656] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.203710 1 genericapiserver.go:656] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.207732 1 genericapiserver.go:656] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW0824 04:06:53.219373 1 genericapiserver.go:656] Skipping API apps/v1beta2 because it has no resources.\nW0824 04:06:53.219391 1 genericapiserver.go:656] Skipping API apps/v1beta1 because it has no resources.\nW0824 04:06:53.221831 1 genericapiserver.go:656] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nW0824 04:06:53.223415 1 genericapiserver.go:656] Skipping API events.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:53.224185 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.\nI0824 04:06:53.224199 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.\nW0824 04:06:53.247003 1 genericapiserver.go:656] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0824 04:06:54.389202 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0824 04:06:54.389224 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 04:06:54.389604 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0824 04:06:54.390124 1 secure_serving.go:210] Serving securely on [::]:6443\nI0824 04:06:54.390171 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0824 04:06:54.390216 1 available_controller.go:491] Starting AvailableConditionController\nI0824 04:06:54.390223 1 cache.go:32] Waiting for caches to sync for AvailableConditionController controller\nI0824 04:06:54.390224 1 controller.go:83] Starting OpenAPI AggregationController\nI0824 04:06:54.390240 1 aggregator.go:151] waiting for initial CRD sync...\nI0824 04:06:54.390414 1 apiservice_controller.go:97] Starting APIServiceRegistrationController\nI0824 04:06:54.390439 1 cache.go:32] Waiting for caches to sync for APIServiceRegistrationController controller\nI0824 04:06:54.390489 1 controller.go:80] Starting OpenAPI V3 AggregationController\nI0824 04:06:54.390540 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\"\nI0824 04:06:54.390861 1 apf_controller.go:312] Starting API Priority and Fairness config controller\nI0824 04:06:54.390963 1 crdregistration_controller.go:111] Starting crd-autoregister controller\nI0824 04:06:54.390976 1 shared_informer.go:252] Waiting for caches to sync for crd-autoregister\nI0824 04:06:54.391004 1 cluster_authentication_trust_controller.go:440] Starting cluster_authentication_trust_controller controller\nI0824 04:06:54.391032 1 shared_informer.go:252] Waiting for caches to sync for cluster_authentication_trust_controller\nI0824 04:06:54.391118 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 04:06:54.391180 1 customresource_disc" - } -] diff --git a/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json index aa50dcdec5..65a1d2ad33 100644 --- a/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-25/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"358e9716-3b87-4719-835c-06dfb96c59c7\",\"resourceVersion\":\"506\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"358e9716-3b87-4719-835c-06dfb96c59c7\",\"resourceVersion\":\"509\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"358e9716-3b87-4719-835c-06dfb96c59c7\",\"resourceVersion\":\"515\",\"generation\":3,\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T04:08:12Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"358e9716-3b87-4719-835c-06dfb96c59c7\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"542\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-696d8f74f9-zf9k6\",\"generateName\":\"k8s-openapi-tests-patch-deployment-696d8f74f9-\",\"namespace\":\"default\",\"uid\":\"e2cef917-6680-4873-9da0-526b5c150275\",\"resourceVersion\":\"523\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"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\":\"83fe89a2-60fb-4d92-a528-107a7aaaa365\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"83fe89a2-60fb-4d92-a528-107a7aaaa365\\\"}\":{}}},\"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-f855f\",\"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-f855f\",\"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\":\"2023-08-24T04:08:12Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-944897db-877vx\",\"generateName\":\"k8s-openapi-tests-patch-deployment-944897db-\",\"namespace\":\"default\",\"uid\":\"12d3b51f-56e4-43b6-b976-1c41369a7ec3\",\"resourceVersion\":\"532\",\"creationTimestamp\":\"2023-08-24T04:08:12Z\",\"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\":\"0a34c6e2-f899-458f-ac9e-2cc5449c1661\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T04:08:12Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"0a34c6e2-f899-458f-ac9e-2cc5449c1661\\\"}\":{}}},\"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\":\"2023-08-24T04:08:12Z\",\"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-xv257\",\"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-xv257\",\"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\":\"2023-08-24T04:08:12Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T04:08:12Z\"}],\"hostIP\":\"172.23.0.2\",\"startTime\":\"2023-08-24T04:08:12Z\",\"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 index 1b5bbe77e0..7d0650bf65 100644 --- a/k8s-openapi-tests/test-replays/v1-25/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-25/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-26/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-26/api_versions-list.json index 3ed240b7ec..b0bcbb4d74 100644 --- a/k8s-openapi-tests/test-replays/v1-26/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-26/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-26/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-26/custom_resource_definition-test.json index 9d1cab0e51..f6463eb123 100644 --- a/k8s-openapi-tests/test-replays/v1-26/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-26/custom_resource_definition-test.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -24,7 +24,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2023-08-24T15:51:36Z\",\"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\":\"2023-08-24T15:51:36Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"580\",\"uid\":\"06d8a43b-9f57-4981-9b91-f16443848482\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -51,7 +51,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"06d8a43b-9f57-4981-9b91-f16443848482\"}}\n" }, @@ -75,7 +75,7 @@ "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", + "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\":\"fe89069a-3c57-43d8-8359-5d5e5e43ae81\",\"resourceVersion\":\"582\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"deletionTimestamp\":\"2023-08-24T15:51:36Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:34Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T15:51:36Z\",\"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-26/deployment-list.json b/k8s-openapi-tests/test-replays/v1-26/deployment-list.json index 4209b468e7..10f9c9bf92 100644 --- a/k8s-openapi-tests/test-replays/v1-26/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-26/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-26/job-create.json b/k8s-openapi-tests/test-replays/v1-26/job-create.json index aa9b126d02..e45946fb1b 100644 --- a/k8s-openapi-tests/test-replays/v1-26/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-26/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -104,7 +104,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"resourceVersion\":\"632\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"controller-uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:45Z\",\"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\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"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\":\"2023-08-24T15:51:45Z\",\"lastTransitionTime\":\"2023-08-24T15:51:45Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -115,7 +115,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"resourceVersion\":\"634\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"deletionTimestamp\":\"2023-08-24T15:51:45Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"controller-uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:45Z\",\"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\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"controller-uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"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\":\"2023-08-24T15:51:45Z\",\"lastTransitionTime\":\"2023-08-24T15:51:45Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, @@ -123,7 +123,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"634\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-qm84b\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"17697a37-8555-46cf-adaf-8b135c39023d\",\"resourceVersion\":\"631\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"controller-uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"78e6c3ba-4a06-44d2-932d-496bcfa4a68f\\\"}\":{}}},\"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\":\"2023-08-24T15:51:44Z\",\"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-t7sj7\",\"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-t7sj7\",\"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.26-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\":\"2023-08-24T15:51:34Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:42Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.7\",\"podIPs\":[{\"ip\":\"10.244.0.7\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2023-08-24T15:51:40Z\",\"finishedAt\":\"2023-08-24T15:51:40Z\",\"containerID\":\"containerd://26737d2f7f87d8842518cb330da3f7a203d9c0c91c5fbf9194ca3e355a33b45a\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a\",\"containerID\":\"containerd://26737d2f7f87d8842518cb330da3f7a203d9c0c91c5fbf9194ca3e355a33b45a\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-26/logs-get.json b/k8s-openapi-tests/test-replays/v1-26/logs-get.json deleted file mode 100644 index 4b98309763..0000000000 --- a/k8s-openapi-tests/test-replays/v1-26/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"518\"},\"items\":[{\"metadata\":{\"name\":\"coredns-787d4945fb-h5psw\",\"generateName\":\"coredns-787d4945fb-\",\"namespace\":\"kube-system\",\"uid\":\"bc88369c-5f97-470b-8acd-0fe99815ea60\",\"resourceVersion\":\"421\",\"creationTimestamp\":\"2023-08-24T15:50:26Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"787d4945fb\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-787d4945fb\",\"uid\":\"729b1a37-1cc0-40a5-bac8-fc7cf7946573\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"729b1a37-1cc0-40a5-bac8-fc7cf7946573\\\"}\":{}}},\"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\":\"2023-08-24T15:50:26Z\",\"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\":\"2023-08-24T15:50:31Z\",\"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.3\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-lfrvj\",\"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-lfrvj\",\"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.26-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:31Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:31Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.3\",\"podIPs\":[{\"ip\":\"10.244.0.3\"}],\"startTime\":\"2023-08-24T15:50:29Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:30Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://9e9816fafef2163c7dd7b2cc69374e57fc4d33e396c42f852de5afd8f12ba4a2\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-787d4945fb-njntv\",\"generateName\":\"coredns-787d4945fb-\",\"namespace\":\"kube-system\",\"uid\":\"9ae3436a-fecb-4b78-9524-66d22f5bd1b8\",\"resourceVersion\":\"431\",\"creationTimestamp\":\"2023-08-24T15:50:26Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"787d4945fb\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-787d4945fb\",\"uid\":\"729b1a37-1cc0-40a5-bac8-fc7cf7946573\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"729b1a37-1cc0-40a5-bac8-fc7cf7946573\\\"}\":{}}},\"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\":\"2023-08-24T15:50:26Z\",\"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\":\"2023-08-24T15:50:31Z\",\"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-cn9j8\",\"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-cn9j8\",\"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.26-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:31Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:31Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2023-08-24T15:50:29Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:30Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.9.3\",\"imageID\":\"sha256:5185b96f0becf59032b8e3646e99f84d9655dff3ac9e2605e0dc77f9c441ae4a\",\"containerID\":\"containerd://0966734e6033b52d35d393c33e00c9e8ce21fe3ba0bd626148000d8915b5c700\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.26-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"7850f8be-2c90-41cc-ba04-ddb9ee24be22\",\"resourceVersion\":\"289\",\"creationTimestamp\":\"2023-08-24T15:50:13Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.23.0.3:2379\",\"kubernetes.io/config.hash\":\"ea7da8310da5c641bfacc77bc9d5b6f1\",\"kubernetes.io/config.mirror\":\"ea7da8310da5c641bfacc77bc9d5b6f1\",\"kubernetes.io/config.seen\":\"2023-08-24T15:50:12.934535198Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.26-control-plane\",\"uid\":\"957a8585-15d4-45de-bd61-7939c0249594\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:13Z\",\"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\\\":\\\"957a8585-15d4-45de-bd61-7939c0249594\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"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.23.0.3\\\"}\":{\".\":{},\"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.6-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.23.0.3: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.23.0.3:2380\",\"--initial-cluster=v1.26-control-plane=https://172.23.0.3:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.23.0.3:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.23.0.3:2380\",\"--name=v1.26-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.26-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\":\"2023-08-24T15:50:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:18Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:18Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:13Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:06Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.6-0\",\"imageID\":\"sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7\",\"containerID\":\"containerd://2374a3990508a075f0d7edb43f268ea0063eeffe2f31f04c9d675202fda22d79\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-69gxt\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"9256477a-fc7c-4465-b15c-4b9372681ef0\",\"resourceVersion\":\"392\",\"creationTimestamp\":\"2023-08-24T15:50:26Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"5877579848\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"fdcdfbd4-7d25-4bfd-bdce-fbc0fde5f46e\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:26Z\",\"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\\\":\\\"fdcdfbd4-7d25-4bfd-bdce-fbc0fde5f46e\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50: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\\\":\\\"172.23.0.3\\\"}\":{\".\":{},\"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-gf6dp\",\"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:v20230511-dc714da8\",\"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.26-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-gf6dp\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.26-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.26-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\":\"2023-08-24T15:50:26Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:29Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:26Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:26Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:28Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20230511-dc714da8\",\"imageID\":\"sha256:b0b1fa0f58c6e932b7f20bf208b2841317a1e8c88cc51b18358310bbd8ec95da\",\"containerID\":\"containerd://e5b3d33abd81d63d5273ee273d24a9a10428709efe511e65aa46212df2c97fad\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.26-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"6a072c7e-99d5-4c7f-89f6-25fabf1b0dea\",\"resourceVersion\":\"296\",\"creationTimestamp\":\"2023-08-24T15:50:13Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.23.0.3:6443\",\"kubernetes.io/config.hash\":\"9205fafc02f1892e0348417fb75491fb\",\"kubernetes.io/config.mirror\":\"9205fafc02f1892e0348417fb75491fb\",\"kubernetes.io/config.seen\":\"2023-08-24T15:50:12.934541159Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.26-control-plane\",\"uid\":\"957a8585-15d4-45de-bd61-7939c0249594\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:13Z\",\"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\\\":\\\"957a8585-15d4-45de-bd61-7939c0249594\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:22Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.26.8\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.23.0.3\",\"--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.23.0.3\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.23.0.3\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.23.0.3\",\"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.26-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\":\"2023-08-24T15:50:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:21Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:21Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:13Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:06Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.26.8\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:da1501323e4befbfb25f4bfe8403920b352f9e6c5ec09174ddbfb60bee572348\",\"containerID\":\"containerd://346490afc36f117555536e43c9e0e08b446a0802d180551409e21d2b8c4061ee\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.26-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"15746436-8f9e-41b0-af51-fef51d0be7a1\",\"resourceVersion\":\"334\",\"creationTimestamp\":\"2023-08-24T15:50:13Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"50e4a58512043d9026fa11c733f959a3\",\"kubernetes.io/config.mirror\":\"50e4a58512043d9026fa11c733f959a3\",\"kubernetes.io/config.seen\":\"2023-08-24T15:50:12.934542371Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.26-control-plane\",\"uid\":\"957a8585-15d4-45de-bd61-7939c0249594\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:13Z\",\"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\\\":\\\"957a8585-15d4-45de-bd61-7939c0249594\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-controller-manager\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/controller-manager.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"flexvolume-dir\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:25Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.26.8\",\"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.26\",\"--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.26-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\":\"2023-08-24T15:50:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:25Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:25Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:13Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:06Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.26.8\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:341b2ba39028991f6df587a53e18938cfbe431a35bb2983f91ab4816931bf229\",\"containerID\":\"containerd://84303c66de9275246afbef785f0932ca71aac8c7da8375f7d668200033ef09d1\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-klbck\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"a1bc205d-ed7b-48af-b0d9-25dad1dae620\",\"resourceVersion\":\"388\",\"creationTimestamp\":\"2023-08-24T15:50:26Z\",\"labels\":{\"controller-revision-hash\":\"6446f764c4\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"9ff92818-6eef-44c7-bdce-168b5c504cb0\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"9ff92818-6eef-44c7-bdce-168b5c504cb0\\\"}\":{}}},\"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\":\"2023-08-24T15:50:28Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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-6q2hw\",\"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.26.8\",\"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-6q2hw\",\"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.26-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.26-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\":\"2023-08-24T15:50:26Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:28Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:28Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:26Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:26Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:27Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.26.8\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:42172f2ddee4f14bb5b8a0481f3b1b1004a045d98e645a8acb3f9b3b06ff27eb\",\"containerID\":\"containerd://53a2556ef5a3bdef639916c8425c31dea3a3b68cfc19e89845664cc7fa2c934e\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.26-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"2a5a89aa-7d2c-4cb4-831d-3202332c395e\",\"resourceVersion\":\"331\",\"creationTimestamp\":\"2023-08-24T15:50:11Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"8e76411e3e444927cd15edbf03a09d0b\",\"kubernetes.io/config.mirror\":\"8e76411e3e444927cd15edbf03a09d0b\",\"kubernetes.io/config.seen\":\"2023-08-24T15:50:04.467973827Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.26-control-plane\",\"uid\":\"957a8585-15d4-45de-bd61-7939c0249594\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:11Z\",\"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\\\":\\\"957a8585-15d4-45de-bd61-7939c0249594\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-scheduler\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/scheduler.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:25Z\",\"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.23.0.3\\\"}\":{\".\":{},\"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.26.8\",\"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.26-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\":\"2023-08-24T15:50:13Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:25Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:25Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:13Z\"}],\"hostIP\":\"172.23.0.3\",\"podIP\":\"172.23.0.3\",\"podIPs\":[{\"ip\":\"172.23.0.3\"}],\"startTime\":\"2023-08-24T15:50:13Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:06Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.26.8\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:942384815cb290d1af94ca2a3c69f6660342ebd4f486bea5cf1847f294a6cfd0\",\"containerID\":\"containerd://b03735a5ca330366290475c3a420dc2ce9fa9c7ca623d0229f00896291ada5a3\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" - }, - { - "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.26-control-plane/log?&container=kube-apiserver", - "request_method": "GET", - "request_body": "", - "request_content_type": null, - "response_status_code": 200, - "response_body": "I0824 15:50:06.204976 1 server.go:557] external host was not specified, using 172.23.0.3\nI0824 15:50:06.206000 1 server.go:164] Version: v1.26.8\nI0824 15:50:06.206033 1 server.go:166] \"Golang settings\" GOGC=\"\" GOMAXPROCS=\"\" GOTRACEBACK=\"\"\nI0824 15:50:06.402978 1 shared_informer.go:270] Waiting for caches to sync for node_authorizer\nI0824 15:50:06.403918 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.\nI0824 15:50:06.403930 1 plugins.go:161] Loaded 12 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,CertificateSubjectRestriction,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook,ResourceQuota.\nW0824 15:50:06.407298 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\"\nW0824 15:50:07.887802 1 genericapiserver.go:660] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0824 15:50:07.888497 1 instance.go:277] Using reconciler: lease\nI0824 15:50:08.177851 1 instance.go:621] API group \"internal.apiserver.k8s.io\" is not enabled, skipping.\nI0824 15:50:08.628217 1 instance.go:621] API group \"resource.k8s.io\" is not enabled, skipping.\nW0824 15:50:08.748716 1 genericapiserver.go:660] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.748740 1 genericapiserver.go:660] Skipping API authentication.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.751069 1 genericapiserver.go:660] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.757149 1 genericapiserver.go:660] Skipping API autoscaling/v2beta1 because it has no resources.\nW0824 15:50:08.757167 1 genericapiserver.go:660] Skipping API autoscaling/v2beta2 because it has no resources.\nW0824 15:50:08.760609 1 genericapiserver.go:660] Skipping API batch/v1beta1 because it has no resources.\nW0824 15:50:08.763080 1 genericapiserver.go:660] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.764711 1 genericapiserver.go:660] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.764755 1 genericapiserver.go:660] Skipping API discovery.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.768562 1 genericapiserver.go:660] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.768578 1 genericapiserver.go:660] Skipping API networking.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.770120 1 genericapiserver.go:660] Skipping API node.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.770131 1 genericapiserver.go:660] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.770163 1 genericapiserver.go:660] Skipping API policy/v1beta1 because it has no resources.\nW0824 15:50:08.774205 1 genericapiserver.go:660] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.774222 1 genericapiserver.go:660] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.775718 1 genericapiserver.go:660] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.775727 1 genericapiserver.go:660] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.780203 1 genericapiserver.go:660] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.784269 1 genericapiserver.go:660] Skipping API flowcontrol.apiserver.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.784281 1 genericapiserver.go:660] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.788706 1 genericapiserver.go:660] Skipping API apps/v1beta2 because it has no resources.\nW0824 15:50:08.788724 1 genericapiserver.go:660] Skipping API apps/v1beta1 because it has no resources.\nW0824 15:50:08.797785 1 genericapiserver.go:660] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.797808 1 genericapiserver.go:660] Skipping API admissionregistration.k8s.io/v1alpha1 because it has no resources.\nW0824 15:50:08.801244 1 genericapiserver.go:660] Skipping API events.k8s.io/v1beta1 because it has no resources.\nW0824 15:50:08.828053 1 genericapiserver.go:660] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0824 15:50:09.475714 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 15:50:09.475714 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0824 15:50:09.476086 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0824 15:50:09.476592 1 secure_serving.go:210] Serving securely on [::]:6443\nI0824 15:50:09.476646 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0824 15:50:09.476712 1 controller.go:80] Starting OpenAPI V3 AggregationController\nI0824 15:50:09.476738 1 controller.go:83] Starting OpenAPI AggregationController\nI0824 15:50:09.476743 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\"\nI0824 15:50:09.476757 1 apf_controller.go:373] Starting API Priority and Fairness config controller\nI0824 15:50:09.476867 1 gc_controller.go:78] Starting apiserver lease garbage collector\nI0824 15:50:09.476897 1 aggregator.go:150] waiting for initial CRD sync...\nI0824 15:50:09.476947 1 crdregistration_controller.go:111] Starting crd-autoregister controller\nI0824 15:50:09.476966 1 shared_informer.go:270] Waiting for caches to sync for crd-autoregister\nI0824 15:50:09.477184 1 customresource_discovery_controller.go:288] Starting DiscoveryController\nI0824 15:50:09.477274 1 controller.go:121] Starting legacy_token_tracking_controller\nI0824 15:50:09.477345 1 naming_controller.go:291] Starting NamingConditionController\nI0824 15:50:09.477389 1 establishing_controller.go:76] Starting EstablishingController\nI0824 15:50:09.477459 1 nonstructuralschema_controller.go:192] Starting NonStructuralSchemaConditionController\nI0824 15:50:09.477499 1 apiapproval_controller.go:186] Starting KubernetesAPIApprovalPolicyConformantConditionController\nI0824 15:50:09.477319 1 controller.go:85] Starting OpenAPI V3 controller\nI0824 15:50:09.477532 1 cluster_authentication_trust_controller.go:440] Starting cluster_authentication_trust_controller controller\nI0824 15:50:09.477539 1 crd_finalizer.go:266] Starting CRDFinalizer\nI0824 15:50:09.477549 1 shared_informer.go:270] Waiting for caches to sync for cluster_authentication_trust_controller\nI0824 15:50:09.476716 1 apiservice_controller.go:97] Starting APIServiceRegistrationController\nI0824 15:50:09.477585 1 cache.go:32] Waiting for caches to sync for APIServiceRegistrationController controller\nI0824 15:50:09.477356 1 shared_informer.go:270] Waiting for caches to sync for configmaps\nI0824 15:50:09.477802 1 controller.go:85] Starting OpenAPI controller\nI0824 15:50:09.477891 1 dynamic_cafile_content.go:157] \"Starting con" - } -] diff --git a/k8s-openapi-tests/test-replays/v1-26/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-26/patch-deployment.json index 8828627b9d..f3f9709573 100644 --- a/k8s-openapi-tests/test-replays/v1-26/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-26/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"7781fa4f-42f9-4fe8-8095-f65e51d9518e\",\"resourceVersion\":\"521\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"7781fa4f-42f9-4fe8-8095-f65e51d9518e\",\"resourceVersion\":\"525\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"7781fa4f-42f9-4fe8-8095-f65e51d9518e\",\"resourceVersion\":\"531\",\"generation\":3,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"7781fa4f-42f9-4fe8-8095-f65e51d9518e\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"551\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-b54c46c4d-ltvwb\",\"generateName\":\"k8s-openapi-tests-patch-deployment-b54c46c4d-\",\"namespace\":\"default\",\"uid\":\"b812e8b4-4a83-4766-bd30-d387c005c9a6\",\"resourceVersion\":\"548\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"b54c46c4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-b54c46c4d\",\"uid\":\"279eddcd-e8f5-41ef-b6f3-fe8b818369d0\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"279eddcd-e8f5-41ef-b6f3-fe8b818369d0\\\"}\":{}}},\"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\":\"2023-08-24T15:51:34Z\",\"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-bdrpz\",\"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-bdrpz\",\"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.26-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\":\"2023-08-24T15:51:34Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\"}],\"hostIP\":\"172.23.0.3\",\"startTime\":\"2023-08-24T15:51:34Z\",\"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-dc48c5687-vjp4q\",\"generateName\":\"k8s-openapi-tests-patch-deployment-dc48c5687-\",\"namespace\":\"default\",\"uid\":\"54a29f27-3691-4d40-a510-f77930fa1687\",\"resourceVersion\":\"543\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"dc48c5687\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-dc48c5687\",\"uid\":\"6a05acf9-36b2-4cc8-905f-3f7c0126f02f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a05acf9-36b2-4cc8-905f-3f7c0126f02f\\\"}\":{}}},\"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-b5zrn\",\"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-b5zrn\",\"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.26-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\":\"2023-08-24T15:51:34Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-26/pod-list.json b/k8s-openapi-tests/test-replays/v1-26/pod-list.json index 1ecdfd6910..06d4dcf500 100644 --- a/k8s-openapi-tests/test-replays/v1-26/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-26/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-27/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-27/api_versions-list.json index 8c61462e74..cb2574d26f 100644 --- a/k8s-openapi-tests/test-replays/v1-27/api_versions-list.json +++ b/k8s-openapi-tests/test-replays/v1-27/api_versions-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/", + "request_url": "/apis", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-27/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-27/custom_resource_definition-test.json index a7f7a1dcf5..3624fbeb09 100644 --- a/k8s-openapi-tests/test-replays/v1-27/custom_resource_definition-test.json +++ b/k8s-openapi-tests/test-replays/v1-27/custom_resource_definition-test.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?", + "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", @@ -24,7 +24,7 @@ "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2023-08-24T15:51:36Z\",\"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\":\"2023-08-24T15:51:36Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"626\",\"uid\":\"71b20830-4412-42fb-a734-611fb9640ae8\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true]}}\n" }, { - "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?", + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -51,7 +51,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"71b20830-4412-42fb-a734-611fb9640ae8\"}}\n" }, @@ -75,7 +75,7 @@ "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", + "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\":\"e86c4e3e-34be-4af2-b43a-925149b4b329\",\"resourceVersion\":\"628\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"deletionTimestamp\":\"2023-08-24T15:51:36Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:34Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2023-08-24T15:51:36Z\",\"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-27/deployment-list.json b/k8s-openapi-tests/test-replays/v1-27/deployment-list.json index ed308b2aef..6a88e1c7df 100644 --- a/k8s-openapi-tests/test-replays/v1-27/deployment-list.json +++ b/k8s-openapi-tests/test-replays/v1-27/deployment-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/kube-system/deployments?", + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/k8s-openapi-tests/test-replays/v1-27/job-create.json b/k8s-openapi-tests/test-replays/v1-27/job-create.json index 2b010737b9..1193e45a01 100644 --- a/k8s-openapi-tests/test-replays/v1-27/job-create.json +++ b/k8s-openapi-tests/test-replays/v1-27/job-create.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/batch/v1/namespaces/default/jobs?", + "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", @@ -112,7 +112,7 @@ "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"resourceVersion\":\"690\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:45Z\",\"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\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"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\":\"2023-08-24T15:51:45Z\",\"lastTransitionTime\":\"2023-08-24T15:51:45Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, { - "request_url": "/api/v1/namespaces/default/pods?", + "request_url": "/api/v1/namespaces/default/pods", "request_method": "GET", "request_body": "", "request_content_type": null, @@ -123,7 +123,7 @@ "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "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\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"resourceVersion\":\"693\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"deletionTimestamp\":\"2023-08-24T15:51:46Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"annotations\":{\"batch.kubernetes.io/job-tracking\":\"\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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\":\"2023-08-24T15:51:45Z\",\"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\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"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\":\"2023-08-24T15:51:45Z\",\"lastTransitionTime\":\"2023-08-24T15:51:45Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"failed\":1,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" }, @@ -131,7 +131,7 @@ "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", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"693\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-f6bvm\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"0e15e8dd-c168-47ed-a2c7-2e8e9c9201df\",\"resourceVersion\":\"689\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"a4522c40-a87b-4be5-bfee-4914ce682c6f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:batch.kubernetes.io/controller-uid\":{},\"f:batch.kubernetes.io/job-name\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"a4522c40-a87b-4be5-bfee-4914ce682c6f\\\"}\":{}}},\"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\":\"2023-08-24T15:51:45Z\",\"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-b6wmn\",\"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-b6wmn\",\"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.27-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\":\"2023-08-24T15:51:34Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:43Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:43Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.9\",\"podIPs\":[{\"ip\":\"10.244.0.9\"}],\"startTime\":\"2023-08-24T15:51:34Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2023-08-24T15:51:42Z\",\"finishedAt\":\"2023-08-24T15:51:42Z\",\"containerID\":\"containerd://a4bd59de80e2b254d1b0f0bf05d91921702369fefb19fb32a59c2151a02a9e94\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a\",\"containerID\":\"containerd://a4bd59de80e2b254d1b0f0bf05d91921702369fefb19fb32a59c2151a02a9e94\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-27/logs-get.json b/k8s-openapi-tests/test-replays/v1-27/logs-get.json deleted file mode 100644 index c0c4d58347..0000000000 --- a/k8s-openapi-tests/test-replays/v1-27/logs-get.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "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\":\"565\"},\"items\":[{\"metadata\":{\"name\":\"coredns-5d78c9869d-87rd8\",\"generateName\":\"coredns-5d78c9869d-\",\"namespace\":\"kube-system\",\"uid\":\"55a5fe88-9bce-4718-99cb-cc10b2da1704\",\"resourceVersion\":\"432\",\"creationTimestamp\":\"2023-08-24T15:49:58Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"5d78c9869d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-5d78c9869d\",\"uid\":\"caeb4fb7-6831-446b-a6be-2473292569ca\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:58Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"caeb4fb7-6831-446b-a6be-2473292569ca\\\"}\":{}}},\"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\":\"2023-08-24T15:49:58Z\",\"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\":\"2023-08-24T15:50:02Z\",\"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.3\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-k2p7s\",\"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.10.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-k2p7s\",\"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.27-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:02Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:02Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.3\",\"podIPs\":[{\"ip\":\"10.244.0.3\"}],\"startTime\":\"2023-08-24T15:50:00Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:01Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.10.1\",\"imageID\":\"sha256:ead0a4a53df89fd173874b46093b6e62d8c72967bbf606d672c9e8c9b601a4fc\",\"containerID\":\"containerd://b3f5defd36402101fe2db9c0d4772169f31a50964f0f9dfad894428a67fdca62\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-5d78c9869d-nk5wh\",\"generateName\":\"coredns-5d78c9869d-\",\"namespace\":\"kube-system\",\"uid\":\"8b2f07d4-b742-4b33-ba9b-0d1ae77bf166\",\"resourceVersion\":\"440\",\"creationTimestamp\":\"2023-08-24T15:49:58Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"5d78c9869d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-5d78c9869d\",\"uid\":\"caeb4fb7-6831-446b-a6be-2473292569ca\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:58Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"caeb4fb7-6831-446b-a6be-2473292569ca\\\"}\":{}}},\"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\":\"2023-08-24T15:49:58Z\",\"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\":\"2023-08-24T15:50:03Z\",\"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-ns6rg\",\"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.10.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-ns6rg\",\"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.27-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:03Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:03Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"10.244.0.4\",\"podIPs\":[{\"ip\":\"10.244.0.4\"}],\"startTime\":\"2023-08-24T15:50:00Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:50:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.10.1\",\"imageID\":\"sha256:ead0a4a53df89fd173874b46093b6e62d8c72967bbf606d672c9e8c9b601a4fc\",\"containerID\":\"containerd://46810b77086d4e6c7e9df8e9df2c6ea6c3d7f5a2982d3fd89697d6c7845b27d0\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.27-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"a1c23bb5-a720-4cdc-8bcd-9bafc480f5f7\",\"resourceVersion\":\"296\",\"creationTimestamp\":\"2023-08-24T15:49:40Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.23.0.2:2379\",\"kubernetes.io/config.hash\":\"ee7ee6fb636c2c649770b96ece4ecc7a\",\"kubernetes.io/config.mirror\":\"ee7ee6fb636c2c649770b96ece4ecc7a\",\"kubernetes.io/config.seen\":\"2023-08-24T15:49:39.997932776Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.27-control-plane\",\"uid\":\"d9be2421-6a60-4e72-ae6a-0312231be5b6\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:40Z\",\"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\\\":\\\"d9be2421-6a60-4e72-ae6a-0312231be5b6\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:54Z\",\"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.23.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.7-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.23.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.23.0.2:2380\",\"--initial-cluster=v1.27-control-plane=https://172.23.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.23.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.23.0.2:2380\",\"--name=v1.27-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.27-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\":\"2023-08-24T15:49:40Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:50Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:50Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:40Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:40Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:34Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.7-0\",\"imageID\":\"sha256:86b6af7dd652c1b38118be1c338e9354b33469e69a218f7e290a0ca5304ad681\",\"containerID\":\"containerd://1782eb947d23e860658fc26c740cc20a8bb628f0a0f68e8ef265d65e1d731d5f\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-jrnfw\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"40dd301c-2cf1-4090-a43e-26d9f242ac2e\",\"resourceVersion\":\"399\",\"creationTimestamp\":\"2023-08-24T15:49:57Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"67889b7d9\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"3784ad23-b983-456c-aa41-ee463b7961be\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:57Z\",\"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\\\":\\\"3784ad23-b983-456c-aa41-ee463b7961be\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:50:00Z\",\"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.23.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-xsm8k\",\"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:v20230511-dc714da8\",\"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.27-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-xsm8k\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.27-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.27-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\":\"2023-08-24T15:49:57Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:50:00Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:57Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:57Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:59Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20230511-dc714da8\",\"imageID\":\"sha256:b0b1fa0f58c6e932b7f20bf208b2841317a1e8c88cc51b18358310bbd8ec95da\",\"containerID\":\"containerd://a152a95bc41afe2d0701e32f4aaba67189d857621b2d7f8e76bcc7c5a7620ea9\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.27-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"7b6a5bd4-82ce-40a8-9726-d6bba7f91941\",\"resourceVersion\":\"286\",\"creationTimestamp\":\"2023-08-24T15:49:40Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.23.0.2:6443\",\"kubernetes.io/config.hash\":\"a8f322abd080e1af2c03ddb9db880ca7\",\"kubernetes.io/config.mirror\":\"a8f322abd080e1af2c03ddb9db880ca7\",\"kubernetes.io/config.seen\":\"2023-08-24T15:49:39.997940140Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.27-control-plane\",\"uid\":\"d9be2421-6a60-4e72-ae6a-0312231be5b6\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:40Z\",\"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\\\":\\\"d9be2421-6a60-4e72-ae6a-0312231be5b6\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:49Z\",\"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.23.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.27.5\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.23.0.2\",\"--allow-privileged=true\",\"--authorization-mode=Node,RBAC\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--enable-admission-plugins=NodeRestriction\",\"--enable-bootstrap-token-auth=true\",\"--etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt\",\"--etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt\",\"--etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key\",\"--etcd-servers=https://127.0.0.1:2379\",\"--feature-gates=WatchList=true\",\"--kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt\",\"--kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key\",\"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname\",\"--proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt\",\"--proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key\",\"--requestheader-allowed-names=front-proxy-client\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--requestheader-extra-headers-prefix=X-Remote-Extra-\",\"--requestheader-group-headers=X-Remote-Group\",\"--requestheader-username-headers=X-Remote-User\",\"--runtime-config=\",\"--secure-port=6443\",\"--service-account-issuer=https://kubernetes.default.svc.cluster.local\",\"--service-account-key-file=/etc/kubernetes/pki/sa.pub\",\"--service-account-signing-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--tls-cert-file=/etc/kubernetes/pki/apiserver.crt\",\"--tls-private-key-file=/etc/kubernetes/pki/apiserver.key\"],\"resources\":{\"requests\":{\"cpu\":\"250m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.23.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.23.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.23.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.27-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\":\"2023-08-24T15:49:40Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:49Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:49Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:40Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:40Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:35Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver:v1.27.5\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:bb903b1be6599bfe80c5865d2cc3058c5a6588db6b400e8771da0f59a604dd44\",\"containerID\":\"containerd://3fd5e63c800c1839af61cf725e44f06ada02d65ad42b17b79d0dc2cfb924e697\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.27-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"42e11b0b-083a-43d8-a7c6-000cbeaaaad9\",\"resourceVersion\":\"293\",\"creationTimestamp\":\"2023-08-24T15:49:40Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"419a65eb961ce922ce1e8d22b57fa27f\",\"kubernetes.io/config.mirror\":\"419a65eb961ce922ce1e8d22b57fa27f\",\"kubernetes.io/config.seen\":\"2023-08-24T15:49:39.997941533Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.27-control-plane\",\"uid\":\"d9be2421-6a60-4e72-ae6a-0312231be5b6\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:40Z\",\"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\\\":\\\"d9be2421-6a60-4e72-ae6a-0312231be5b6\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-controller-manager\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/controller-manager.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"flexvolume-dir\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:51Z\",\"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.23.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.27.5\",\"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.27\",\"--cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt\",\"--cluster-signing-key-file=/etc/kubernetes/pki/ca.key\",\"--controllers=*,bootstrapsigner,tokencleaner\",\"--enable-hostpath-provisioner=true\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--leader-elect=true\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--root-ca-file=/etc/kubernetes/pki/ca.crt\",\"--service-account-private-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--use-service-account-credentials=true\"],\"resources\":{\"requests\":{\"cpu\":\"200m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"flexvolume-dir\",\"mountPath\":\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/controller-manager.conf\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.27-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\":\"2023-08-24T15:49:40Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:50Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:50Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:40Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:40Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:35Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager:v1.27.5\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:806a5770ad69aac72ed1802907a634f971ca79f834d5d74efde0413f1ed9d8bc\",\"containerID\":\"containerd://a667196b32e1952f9e592029f752272407422b2a8292ade2a826ce06b7c652b7\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-d6bmk\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"52455cba-7a8c-41b3-bee7-ebe9da85770c\",\"resourceVersion\":\"393\",\"creationTimestamp\":\"2023-08-24T15:49:57Z\",\"labels\":{\"controller-revision-hash\":\"77c6dd5886\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"711dabbb-4ef2-402b-9b05-89169c5c5016\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:57Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"711dabbb-4ef2-402b-9b05-89169c5c5016\\\"}\":{}}},\"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\":\"2023-08-24T15:49:59Z\",\"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.23.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-9xbtm\",\"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.27.5\",\"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-9xbtm\",\"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.27-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.27-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\":\"2023-08-24T15:49:57Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:59Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:59Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:57Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:57Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:58Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy:v1.27.5\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:ca2563e1fb958d1a38d9300434eba67955d7c025bd0f89c14dcb48e610d2b14a\",\"containerID\":\"containerd://0aca517aa6d75c501d63923a20444771563c0ce2542d90e773b245b8ec8f4c33\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.27-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"392d0bca-2af3-49b8-8f8d-1c281f2b97cd\",\"resourceVersion\":\"298\",\"creationTimestamp\":\"2023-08-24T15:49:38Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"4f4e1ddc056637eea127ff7d6f550322\",\"kubernetes.io/config.mirror\":\"4f4e1ddc056637eea127ff7d6f550322\",\"kubernetes.io/config.seen\":\"2023-08-24T15:49:29.214563090Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.27-control-plane\",\"uid\":\"d9be2421-6a60-4e72-ae6a-0312231be5b6\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:38Z\",\"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\\\":\\\"d9be2421-6a60-4e72-ae6a-0312231be5b6\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-scheduler\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/scheduler.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:49:54Z\",\"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.23.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.27.5\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/scheduler.conf\",\"--leader-elect=true\"],\"resources\":{\"requests\":{\"cpu\":\"100m\"}},\"volumeMounts\":[{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/scheduler.conf\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.27-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\":\"2023-08-24T15:49:40Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:52Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:52Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:49:40Z\"}],\"hostIP\":\"172.23.0.2\",\"podIP\":\"172.23.0.2\",\"podIPs\":[{\"ip\":\"172.23.0.2\"}],\"startTime\":\"2023-08-24T15:49:40Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2023-08-24T15:49:34Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler:v1.27.5\",\"imageID\":\"docker.io/library/import-2023-08-24@sha256:55b53b84b031020968d0857eb172508d4392c59673aad458f56f6fe6d51cbfdc\",\"containerID\":\"containerd://9ad20e1b7b4f83a587010c018138e94bd459cc457e111af7804a5e1104288501\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" - }, - { - "request_url": "/api/v1/namespaces/kube-system/pods/kube-apiserver-v1.27-control-plane/log?&container=kube-apiserver", - "request_method": "GET", - "request_body": "", - "request_content_type": null, - "response_status_code": 200, - "response_body": "I0824 15:49:35.117771 1 server.go:553] external host was not specified, using 172.23.0.2\nI0824 15:49:35.119049 1 server.go:166] Version: v1.27.5\nI0824 15:49:35.119110 1 server.go:168] \"Golang settings\" GOGC=\"\" GOMAXPROCS=\"\" GOTRACEBACK=\"\"\nI0824 15:49:35.396589 1 shared_informer.go:311] Waiting for caches to sync for node_authorizer\nI0824 15:49:35.412331 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.\nI0824 15:49:35.412367 1 plugins.go:161] Loaded 13 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,ClusterTrustBundleAttest,CertificateSubjectRestriction,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook,ResourceQuota.\nI0824 15:49:35.443466 1 handler.go:232] Adding GroupVersion apiextensions.k8s.io v1 to ResourceManager\nW0824 15:49:35.443487 1 genericapiserver.go:752] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.\nI0824 15:49:35.444431 1 instance.go:282] Using reconciler: lease\nI0824 15:49:35.650034 1 handler.go:232] Adding GroupVersion v1 to ResourceManager\nI0824 15:49:35.650320 1 instance.go:651] API group \"internal.apiserver.k8s.io\" is not enabled, skipping.\nI0824 15:49:36.045913 1 instance.go:651] API group \"resource.k8s.io\" is not enabled, skipping.\nI0824 15:49:36.059490 1 handler.go:232] Adding GroupVersion authentication.k8s.io v1 to ResourceManager\nW0824 15:49:36.059522 1 genericapiserver.go:752] Skipping API authentication.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.059535 1 genericapiserver.go:752] Skipping API authentication.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.064060 1 handler.go:232] Adding GroupVersion authorization.k8s.io v1 to ResourceManager\nW0824 15:49:36.064094 1 genericapiserver.go:752] Skipping API authorization.k8s.io/v1beta1 because it has no resources.\nI0824 15:49:36.068104 1 handler.go:232] Adding GroupVersion autoscaling v2 to ResourceManager\nI0824 15:49:36.069005 1 handler.go:232] Adding GroupVersion autoscaling v1 to ResourceManager\nW0824 15:49:36.069025 1 genericapiserver.go:752] Skipping API autoscaling/v2beta1 because it has no resources.\nW0824 15:49:36.069034 1 genericapiserver.go:752] Skipping API autoscaling/v2beta2 because it has no resources.\nI0824 15:49:36.073416 1 handler.go:232] Adding GroupVersion batch v1 to ResourceManager\nW0824 15:49:36.073447 1 genericapiserver.go:752] Skipping API batch/v1beta1 because it has no resources.\nI0824 15:49:36.077323 1 handler.go:232] Adding GroupVersion certificates.k8s.io v1 to ResourceManager\nW0824 15:49:36.077357 1 genericapiserver.go:752] Skipping API certificates.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.077367 1 genericapiserver.go:752] Skipping API certificates.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.080663 1 handler.go:232] Adding GroupVersion coordination.k8s.io v1 to ResourceManager\nW0824 15:49:36.080690 1 genericapiserver.go:752] Skipping API coordination.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.083258 1 genericapiserver.go:752] Skipping API discovery.k8s.io/v1beta1 because it has no resources.\nI0824 15:49:36.084075 1 handler.go:232] Adding GroupVersion discovery.k8s.io v1 to ResourceManager\nI0824 15:49:36.088606 1 handler.go:232] Adding GroupVersion networking.k8s.io v1 to ResourceManager\nW0824 15:49:36.088638 1 genericapiserver.go:752] Skipping API networking.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.088650 1 genericapiserver.go:752] Skipping API networking.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.091629 1 handler.go:232] Adding GroupVersion node.k8s.io v1 to ResourceManager\nW0824 15:49:36.091661 1 genericapiserver.go:752] Skipping API node.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.091671 1 genericapiserver.go:752] Skipping API node.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.094996 1 handler.go:232] Adding GroupVersion policy v1 to ResourceManager\nW0824 15:49:36.095026 1 genericapiserver.go:752] Skipping API policy/v1beta1 because it has no resources.\nI0824 15:49:36.099701 1 handler.go:232] Adding GroupVersion rbac.authorization.k8s.io v1 to ResourceManager\nW0824 15:49:36.099736 1 genericapiserver.go:752] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.099747 1 genericapiserver.go:752] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.102768 1 handler.go:232] Adding GroupVersion scheduling.k8s.io v1 to ResourceManager\nW0824 15:49:36.102808 1 genericapiserver.go:752] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.102818 1 genericapiserver.go:752] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.108500 1 handler.go:232] Adding GroupVersion storage.k8s.io v1 to ResourceManager\nW0824 15:49:36.108537 1 genericapiserver.go:752] Skipping API storage.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.108549 1 genericapiserver.go:752] Skipping API storage.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.113074 1 handler.go:232] Adding GroupVersion flowcontrol.apiserver.k8s.io v1beta3 to ResourceManager\nI0824 15:49:36.114670 1 handler.go:232] Adding GroupVersion flowcontrol.apiserver.k8s.io v1beta2 to ResourceManager\nW0824 15:49:36.114695 1 genericapiserver.go:752] Skipping API flowcontrol.apiserver.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.114703 1 genericapiserver.go:752] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.123296 1 handler.go:232] Adding GroupVersion apps v1 to ResourceManager\nW0824 15:49:36.123327 1 genericapiserver.go:752] Skipping API apps/v1beta2 because it has no resources.\nW0824 15:49:36.123336 1 genericapiserver.go:752] Skipping API apps/v1beta1 because it has no resources.\nI0824 15:49:36.127550 1 handler.go:232] Adding GroupVersion admissionregistration.k8s.io v1 to ResourceManager\nW0824 15:49:36.127581 1 genericapiserver.go:752] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.\nW0824 15:49:36.127590 1 genericapiserver.go:752] Skipping API admissionregistration.k8s.io/v1alpha1 because it has no resources.\nI0824 15:49:36.131239 1 handler.go:232] Adding GroupVersion events.k8s.io v1 to ResourceManager\nW0824 15:49:36.131268 1 genericapiserver.go:752] Skipping API events.k8s.io/v1beta1 because it has no resources.\nI0824 15:49:36.147078 1 handler.go:232] Adding GroupVersion apiregistration.k8s.io v1 to ResourceManager\nW0824 15:49:36.147114 1 genericapiserver.go:752] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.\nI0824 15:49:36.760597 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"request-header::/etc/kubernetes/pki/front-proxy-ca.crt\"\nI0824 15:49:36.760620 1 dynamic_cafile_content.go:157] \"Starting controller\" name=\"client-ca-bundle::/etc/kubernetes/pki/ca.crt\"\nI0824 15:49:36.761035 1 dynamic_serving_content.go:132] \"Starting controller\" name=\"serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key\"\nI0824 15:49:36.761542 1 secure_serving.go:210] Serving securely on [::]:6443\nI0824 15:49:36.761603 1 tlsconfig.go:240] \"Starting DynamicServingCertificateController\"\nI0824 15:49:36.762165 1 apf_controller.go:373] Starting API Priority and Fairness config controller\nI0824 15:49:36.762189 1 cluster_authentication_trust_" - } -] diff --git a/k8s-openapi-tests/test-replays/v1-27/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-27/patch-deployment.json index 556a59d3cd..43a45d418c 100644 --- a/k8s-openapi-tests/test-replays/v1-27/patch-deployment.json +++ b/k8s-openapi-tests/test-replays/v1-27/patch-deployment.json @@ -1,6 +1,6 @@ [ { - "request_url": "/apis/apps/v1/namespaces/default/deployments?", + "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", @@ -8,7 +8,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"2f2d3b7d-8ed3-4944-a1fb-c47e6d965313\",\"resourceVersion\":\"564\",\"generation\":1,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -16,7 +16,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"2f2d3b7d-8ed3-4944-a1fb-c47e6d965313\",\"resourceVersion\":\"569\",\"generation\":2,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -24,7 +24,7 @@ "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"2f2d3b7d-8ed3-4944-a1fb-c47e6d965313\",\"resourceVersion\":\"574\",\"generation\":3,\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-08-24T15:51:34Z\",\"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_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", @@ -35,7 +35,7 @@ "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", "request_method": "DELETE", "request_body": "", - "request_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"2f2d3b7d-8ed3-4944-a1fb-c47e6d965313\"}}\n" }, @@ -43,7 +43,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_content_type": "application/json", + "request_content_type": null, "response_status_code": 200, "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"597\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-54f76445c8-2lnqc\",\"generateName\":\"k8s-openapi-tests-patch-deployment-54f76445c8-\",\"namespace\":\"default\",\"uid\":\"6f05f86c-fa04-437a-9884-319733df23e0\",\"resourceVersion\":\"592\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"54f76445c8\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-54f76445c8\",\"uid\":\"d20c01bd-1c4a-4ab4-9f4d-ebde4a3438b4\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"d20c01bd-1c4a-4ab4-9f4d-ebde4a3438b4\\\"}\":{}}},\"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\":\"2023-08-24T15:51:34Z\",\"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-qb5fm\",\"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-qb5fm\",\"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.27-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\":\"2023-08-24T15:51:34Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\",\"reason\":\"ContainersNotReady\",\"message\":\"containers with unready status: [k8s-openapi-tests-patch-deployment]\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2023-08-24T15:51:34Z\"}],\"hostIP\":\"172.23.0.2\",\"startTime\":\"2023-08-24T15:51:34Z\",\"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-6d75f5bcd7-tprkv\",\"generateName\":\"k8s-openapi-tests-patch-deployment-6d75f5bcd7-\",\"namespace\":\"default\",\"uid\":\"0a25da89-215e-4254-bf85-770fc74669dd\",\"resourceVersion\":\"589\",\"creationTimestamp\":\"2023-08-24T15:51:34Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"6d75f5bcd7\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-6d75f5bcd7\",\"uid\":\"b757632f-0017-4fe7-9f2f-87ec3a530f97\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2023-08-24T15:51:34Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"b757632f-0017-4fe7-9f2f-87ec3a530f97\\\"}\":{}}},\"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-t6h7d\",\"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-t6h7d\",\"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.27-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\":\"2023-08-24T15:51:34Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" } diff --git a/k8s-openapi-tests/test-replays/v1-27/pod-list.json b/k8s-openapi-tests/test-replays/v1-27/pod-list.json index f9227c6eb0..dcd93b3325 100644 --- a/k8s-openapi-tests/test-replays/v1-27/pod-list.json +++ b/k8s-openapi-tests/test-replays/v1-27/pod-list.json @@ -1,6 +1,6 @@ [ { - "request_url": "/api/v1/namespaces/kube-system/pods?", + "request_url": "/api/v1/namespaces/kube-system/pods", "request_method": "GET", "request_body": "", "request_content_type": null, diff --git a/src/api.rs b/src/api.rs deleted file mode 100644 index d665405f63..0000000000 --- a/src/api.rs +++ /dev/null @@ -1,153 +0,0 @@ -/// The type of errors returned by the Kubernetes API functions that prepare the HTTP request. -#[derive(Debug)] -pub enum RequestError { - /// An error from preparing the HTTP request. - Http(http::Error), - - /// An error while serializing a value into the JSON body of the HTTP request. - Json(serde_json::Error), -} - -impl std::fmt::Display for RequestError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - RequestError::Http(err) => write!(f, "{err}"), - RequestError::Json(err) => write!(f, "{err}"), - } - } -} - -impl std::error::Error for RequestError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - RequestError::Http(err) => Some(err), - RequestError::Json(err) => Some(err), - } - } -} - -/// A trait implemented by all response types corresponding to Kubernetes API functions. -pub trait Response: Sized { - /// Tries to parse the response from the given status code and response body. - /// - /// If an instance of `Self` can be successfully parsed from the given byte buffer, the instance is returned, - /// along with the number of bytes used up from the buffer. Remove those bytes from the buffer before calling - /// this function again. - /// - /// If the buffer does not contain enough bytes to be able to parse an instance of `Self`, the function returns - /// `Err(ResponseError::NeedMoreData)`. Append more bytes into the buffer, then call this function again. - /// - /// Also see the [`ResponseBody`] type. - fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), ResponseError>; -} - -/// This struct provides an easy way to parse a byte buffer into a Kubernetes API function's response. -/// -/// All API function responses implement the [`Response`] trait, and are constructed by calling their [`Response::try_from_parts`] function. -/// If this function returns `Err(ResponseError::NeedMoreData)`, that means more bytes need to be appended to the function. Alternatively, -/// if the function returns `Ok((value, num_bytes_read))`, then `num_bytes_read` bytes need to be popped off from the front of the buffer. -/// -/// The `ResponseBody` struct contains an internal dynamic buffer, and provides `append_slice` and `parse` functions to help with this. -/// `append_slice` appends the slice you give it to its internal buffer, and `parse` uses the [`Response::try_from_parts`] function to parse -/// the response out of the buffer, and truncates it accordingly. -/// -/// You do not *have* to use this type to parse the response, say if you want to manage your own byte buffers. You can use -/// `::try_from_parts` directly instead. -pub struct ResponseBody { - /// The HTTP status code of the response. - pub status_code: http::StatusCode, - - buf: bytes::BytesMut, - - _response: std::marker::PhantomData T>, -} - -impl ResponseBody where T: Response { - /// Construct a value for a response that has the specified HTTP status code. - pub fn new(status_code: http::StatusCode) -> Self { - ResponseBody { - status_code, - buf: Default::default(), - _response: Default::default(), - } - } - - /// Append a slice of data from the HTTP response to this buffer. - pub fn append_slice(&mut self, buf: &[u8]) { - self.buf.extend_from_slice(buf); - } - - /// Try to parse all the data buffered so far into a response type. - pub fn parse(&mut self) -> Result { - match T::try_from_parts(self.status_code, &self.buf) { - Ok((result, read)) => { - self.advance(read); - Ok(result) - }, - - Err(err) => Err(err), - } - } - - /// Drop the first `cnt` bytes of this buffer. - /// - /// This is useful for skipping over malformed bytes, such as invalid utf-8 sequences when parsing streaming `String` responses - /// like from [`api::core::v1::Pod::read_log`](crate::api::core::v1::Pod::read_log). - /// - /// # Panics - /// - /// This function panics if `cnt` is greater than the length of the internal buffer. - pub fn advance(&mut self, cnt: usize) { - bytes::Buf::advance(&mut self.buf, cnt); - } -} - -impl std::ops::Deref for ResponseBody { - type Target = [u8]; - - fn deref(&self) -> &Self::Target { - &self.buf - } -} - -/// The type of errors from parsing an HTTP response as one of the Kubernetes API functions' response types. -#[derive(Debug)] -pub enum ResponseError { - /// An error from deserializing the HTTP response, indicating more data is needed to complete deserialization. - NeedMoreData, - - /// An error while deserializing the HTTP response as a JSON value, indicating the response is malformed. - Json(serde_json::Error), - - /// An error while deserializing the HTTP response as a string, indicating that the response data is not UTF-8. - Utf8(std::str::Utf8Error), -} - -impl std::fmt::Display for ResponseError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ResponseError::NeedMoreData => f.write_str("need more response data"), - ResponseError::Json(err) => write!(f, "{err}"), - ResponseError::Utf8(err) => write!(f, "{err}"), - } - } -} - -impl std::error::Error for ResponseError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - ResponseError::NeedMoreData => None, - ResponseError::Json(err) => Some(err), - ResponseError::Utf8(err) => Some(err), - } - } -} - -/// Extensions to the percent-encoding crate -pub mod percent_encoding2 { - /// Ref - pub const PATH_SEGMENT_ENCODE_SET: &percent_encoding::AsciiSet = - &percent_encoding::CONTROLS - .add(b' ').add(b'"').add(b'<').add(b'>').add(b'`') // fragment percent-encode set - .add(b'#').add(b'?').add(b'{').add(b'}'); // path percent-encode set -} diff --git a/src/lib.rs b/src/lib.rs index 303b7fe92b..ffc614eaff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,188 +46,12 @@ //! } //! ``` //! -//! ## Client API -//! -#![cfg_attr(feature = "api", doc = r#" -(This requires the `api` feature to be enabled. The feature is enabled by default. See ["Crate features"](#crate-features) below for more details.) - -This example executes the [`api::core::v1::Pod::list`] API operation to list all pods inside a namespace. -It demonstrates the common patterns implemented by all API operation functions in this crate: - -1. The API function has required parameters and optional parameters. All optional parameters are taken as a single struct with optional fields. - - Specifically for the [`api::core::v1::Pod::list`] operation, the `namespace` parameter is required and taken by the function itself, - while other optional parameters like `field_selector` are fields of the [`ListOptional`] struct. An instance of - this struct is taken as the last parameter of `Pod::list`. This struct impls [`Default`] so that you can just pass in `Default::default()` - if you don't want to specify values for any of the optional parameters. - - Some API operations have a single common type for optional parameters: - - - All create API take optional parameters using the [`CreateOptional`] struct. - - All delete API take optional parameters using the [`DeleteOptional`] struct. - - All list API take optional parameters using the [`ListOptional`] struct. - - All patch API take optional parameters using the [`PatchOptional`] struct. - - All replace API take optional parameters using the [`ReplaceOptional`] struct. - - All watch API take optional parameters using the [`WatchOptional`] struct. - - All delete-collection API take optional parameters using the [`DeleteOptional`] struct for delete options and the [`ListOptional`] struct for list options. - - Other API functions have their own `Optional` structs with fields corresponding to the specific parameters for those functions, - such as [`api::core::v1::ReadPodLogOptional`] for [`api::core::v1::Pod::read_log`] - -1. The function returns an [`http::Request`] value with the URL path, query string, and request body filled out according to the parameters - given to the function. The function does *not* execute this request. You can execute this `http::Request` using any HTTP client library you want to use. - It does not matter whether you use a synchronous client like `reqwest`, or an asynchronous client like `hyper`, or a mock client that returns bytes - read from a test file. - -1. For each API operation function, there is a corresponding response type. For `Pod::list` this is [`ListResponse`]`<`[`api::core::v1::Pod`]`>`. - This is an enum with variants for each of the possible HTTP status codes that the operation can return, and contains the data that the API server would - return corresponding to that status code. For example, the list-namespaced-pod operation returns a pod list with HTTP 200 OK, so one of the variants of - that type is `Ok(`[`List`]`<`[`api::core::v1::Pod`]`>)` - -1. The response types impl the [`Response`] trait, which contains a single [`Response::try_from_parts`] function. This function takes an [`http::StatusCode`] - and a `&u8` byte buffer, and tries to parse the byte buffer as the response type. For example, if you executed the request and received an HTTP 200 OK response - with some bytes, you could call ` as Response>::try_from_parts(status_code, buf)` and expect to get - `Ok(ListResponse::::Ok(pod_list))` from it. - - Once again, this design ensures that the crate is not tied to a specific HTTP client library or interface. It does not matter how you execute the HTTP request, - nor whether your library is synchronous or asynchronous, since every HTTP client library gives you a way to get the HTTP response status code and the bytes - of the response body. - -1. The API operation function also returns another value next to the `http::Request`. This value is a function that takes an [`http::StatusCode`] and returns - a [`ResponseBody`]`>`. As mentioned above, `Response::try_from_parts` requires you to maintain a byte buffer for the response body. - `ResponseBody` is a helper that maintains such a buffer internally. It provides an `append_slice()` function to append slices to this internal buffer, - and a `parse()` function to parse the buffer as the expected type (`ListResponse` in this case). - - It is not *necessary* to use the `ResponseBody` returned by the API operation function to parse the response. The `ResponseBody::parse` function is - only a wrapper around the underlying `Response::try_from_parts` function, and handles growing and shrinking its inner buffer as necessary. It also - helps ensure that the response body is parsed as the *correct* type for the operation, `ListResponse` in this case, and not some other type. - However, you can instead use your own byte buffer instead of the `ResponseBody` value and call `ListResponse::try_from_parts` yourself. - -1. The response types are enums with variants corresponding to HTTP status codes. For example, the `ListResponse::Ok` variant corresponds to the - HTTP 200 response of the list-namespaced-pod API. - - Each response enum also has an `Other` variant, that is yielded when the response status code does not match any of the other variants. - This variant has a `Result, `[`serde_json::Error`]`>` value. - - If the response body is empty, this value will be `Ok(None)`. - - If the response body is not empty, this value will be an `Ok(Some(value))` or `Err(err)` from attempting to parse that body as a `serde_json::Value`. - If you expect the response body to be a specific JSON type such as [`apimachinery::pkg::apis::meta::v1::Status`], you can use the `serde_json::Value` - as a [`serde::Deserializer`] like `let status = ::deserialize(value)?;`. On the other hand, if you expect the response body to not be - a JSON value, then ignore the `Err(err)` and parse the raw bytes of the response into the appropriate type. - -Also see the `get_single_value` and `get_multiple_values` functions in -[the `k8s-openapi-tests` directory in the repository](https://github.com/Arnavion/k8s-openapi/tree/master/k8s-openapi-tests/src) -for examples of how to use a synchronous client with this style of API. - -```rust,no_run -// Re-export of the http crate since it's used in the public API -use k8s_openapi::http; - -use k8s_openapi::api::core::v1 as api; - -# struct Response; -# impl Response { -# fn status_code(&self) -> http::StatusCode { -# unimplemented!() -# } -# fn read_into(&self, _buf: &mut [u8]) -> std::io::Result { -# unimplemented!() -# } -# } -# -// Assume `execute` is some function that takes an `http::Request` and -// executes it synchronously or asynchronously to get a response. This is -// provided by your HTTP client library. -// -// Note that the `http::Request` values returned by API operation functions -// only have a URL path, query string and request body filled out. That is, -// they do *not* have a URL host. So the real `execute` implementation -// would first mutate the URL of the request to an absolute URL with -// the API server's authority, add authorization headers, etc before -// actually executing it. -fn execute(req: http::Request>) -> Response { unimplemented!(); } - -fn main() -> Result<(), Box> { - // Create a `http::Request` to list all the pods in the - // "kube-system" namespace. - let (request, response_body) = - api::Pod::list("kube-system", Default::default())?; - - // Execute the request and get a response. - // If this is an asynchronous operation, you would await - // or otherwise yield to the event loop here. - let response = execute(request); - - // Got a status code from executing the request. - let status_code: http::StatusCode = response.status_code(); - - // Construct the `ResponseBody>` using the - // constructor returned by the API function. - let mut response_body = response_body(status_code); - - // Buffer used for each read from the HTTP response. - let mut buf = Box::new([0_u8; 4096]); - - let pod_list = loop { - // Read some bytes from the HTTP response into the buffer. - // If this is an asynchronous operation, you would await or - // yield to the event loop here. - let read = response.read_into(&mut *buf)?; - - // `buf` now contains some data read from the response. Append it - // to the `ResponseBody` and try to parse it into - // the response type. - response_body.append_slice(&buf[..read]); - let response = response_body.parse(); - match response { - // Successful response (HTTP 200 and parsed successfully) - Ok(k8s_openapi::ListResponse::Ok(pod_list)) => - break pod_list, - - // Some unexpected response - // (not HTTP 200, but still parsed successfully) - Ok(other) => return Err(format!( - "expected Ok but got {status_code} {other:?}").into()), - - // Need more response data. - // Read more bytes from the response into the `ResponseBody` - Err(k8s_openapi::ResponseError::NeedMoreData) => continue, - - // Some other error, like the response body being - // malformed JSON or invalid UTF-8. - Err(err) => return Err(format!( - "error: {status_code} {err:?}").into()), - } - }; - - for pod in pod_list.items { - println!("{pod:#?}",); - } - - Ok(()) -} -``` -"#)] -#![cfg_attr(not(feature = "api"), doc = r#" -The `api` feature has been disabled, so the client API is not available. See ["Crate features"](#crate-features) below for more details. -"#)] -//! //! //! # Crate features //! -//! - This crate contains several `v1_*` features. Enabling one of the `v1_*` features selects which version of the Kubernetes API server this crate should target. -//! For example, enabling the `v1_23` feature means the crate will only contain the API exposed by Kubernetes 1.23. It will not expose API -//! that were removed in 1.23 or earlier, nor any API added in 1.24 or later. -//! -//! - The crate also contains a feature named `api`. If this feature is disabled, the library will only contain the resource types like [`api::core::v1::Pod`], -//! and not the associated operation functions like -#![cfg_attr(feature = "api", doc = "[`api::core::v1::Pod::read`]")] -#![cfg_attr(not(feature = "api"), doc = "`api::core::v1::Pod::read`")] -//! . The `Response` and `Optional` types for the operation functions -//! will also not be accessible. -//! -//! This feature is enabled by default, but can be disabled if your crate does not need the operation functions to save on compile time and resources. +//! This crate contains several `v1_*` features. Enabling one of the `v1_*` features selects which version of the Kubernetes API server this crate should target. +//! For example, enabling the `v1_23` feature means the crate will only contain the API exposed by Kubernetes 1.23. It will not expose API +//! that were removed in 1.23 or earlier, nor any API added in 1.24 or later. //! //! One and only one of the `v1_*` features must be enabled at the same time, otherwise the crate will not compile. This ensures that all crates in the crate graph //! use the same types. If it was possible for one library crate to use `api::core::v1::Pod` corresponding to v1.50 and another to use the type @@ -399,27 +223,12 @@ The `api` feature has been disabled, so the client API is not available. See ["C //! for custom resources. See that crate's docs for more information. pub use chrono; -#[cfg(feature = "api")] -pub use http; -#[cfg(feature = "api")] -pub use percent_encoding; #[cfg(feature = "schemars")] pub use schemars; pub use serde; pub use serde_json; pub use serde_value; -#[cfg(feature = "api")] -pub use url; -#[cfg(feature = "api")] -#[path = "api.rs"] -mod _api; -#[cfg(feature = "api")] -pub use _api::{ - RequestError, - Response, ResponseBody, ResponseError, - percent_encoding2, -}; #[path = "byte_string.rs"] mod _byte_string; diff --git a/src/v1_22/api/admissionregistration/v1/mod.rs b/src/v1_22/api/admissionregistration/v1/mod.rs index ace31fe7fb..4b1bbcbd9c 100644 --- a/src/v1_22/api/admissionregistration/v1/mod.rs +++ b/src/v1_22/api/admissionregistration/v1/mod.rs @@ -4,7 +4,6 @@ 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; @@ -17,7 +16,6 @@ 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_22/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_22/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; 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 ff20990424..f188208c4d 100644 --- a/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_22/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_22/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_22/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_22/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_22/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs index 6b8779e542..a7e96da6f8 100644 --- a/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_22/api/apiserverinternal/v1alpha1/storage_version.rs @@ -14,495 +14,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_22/api/apps/v1/controller_revision.rs b/src/v1_22/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_22/api/apps/v1/controller_revision.rs +++ b/src/v1_22/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_22/api/apps/v1/daemon_set.rs b/src/v1_22/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_22/api/apps/v1/daemon_set.rs +++ b/src/v1_22/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_22/api/apps/v1/deployment.rs b/src/v1_22/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_22/api/apps/v1/deployment.rs +++ b/src/v1_22/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_22/api/apps/v1/mod.rs b/src/v1_22/api/apps/v1/mod.rs index 979c7b1e0f..209e763774 100644 --- a/src/v1_22/api/apps/v1/mod.rs +++ b/src/v1_22/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_22/api/apps/v1/replica_set.rs b/src/v1_22/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_22/api/apps/v1/replica_set.rs +++ b/src/v1_22/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_22/api/apps/v1/stateful_set.rs b/src/v1_22/api/apps/v1/stateful_set.rs index 5c62142458..53354a4276 100644 --- a/src/v1_22/api/apps/v1/stateful_set.rs +++ b/src/v1_22/api/apps/v1/stateful_set.rs @@ -16,629 +16,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_22/api/authentication/v1/token_request.rs b/src/v1_22/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_22/api/authentication/v1/token_request.rs +++ b/src/v1_22/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_22/api/authentication/v1/token_review.rs b/src/v1_22/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_22/api/authentication/v1/token_review.rs +++ b/src/v1_22/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; diff --git a/src/v1_22/api/authorization/v1/local_subject_access_review.rs b/src/v1_22/api/authorization/v1/local_subject_access_review.rs index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_22/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_22/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; diff --git a/src/v1_22/api/authorization/v1/self_subject_access_review.rs b/src/v1_22/api/authorization/v1/self_subject_access_review.rs index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_22/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_22/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; diff --git a/src/v1_22/api/authorization/v1/self_subject_rules_review.rs b/src/v1_22/api/authorization/v1/self_subject_rules_review.rs index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_22/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_22/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_22/api/authorization/v1/subject_access_review.rs b/src/v1_22/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_22/api/authorization/v1/subject_access_review.rs +++ b/src/v1_22/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; 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 01ee0ebcfc..79156137f7 100644 --- a/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_22/api/autoscaling/v1/mod.rs b/src/v1_22/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_22/api/autoscaling/v1/mod.rs +++ b/src/v1_22/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_22/api/autoscaling/v1/scale.rs b/src/v1_22/api/autoscaling/v1/scale.rs index 89a7024529..8e96f95929 100644 --- a/src/v1_22/api/autoscaling/v1/scale.rs +++ b/src/v1_22/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; 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 50b9970024..8ba3951299 100644 --- a/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { pub status: Option, } -// Begin autoscaling/v2beta1/HorizontalPodAutoscaler - -// Generated from operation createAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 deleteAutoscalingV2beta1CollectionNamespacedHorizontalPodAutoscaler - -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/v2beta1/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 deleteAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 listAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 listAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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::v2beta1::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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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::v2beta1::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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 watchAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 watchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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/v2beta1/HorizontalPodAutoscaler - impl crate::Resource for HorizontalPodAutoscaler { const API_VERSION: &'static str = "autoscaling/v2beta1"; const GROUP: &'static str = "autoscaling"; diff --git a/src/v1_22/api/autoscaling/v2beta1/mod.rs b/src/v1_22/api/autoscaling/v2beta1/mod.rs index c4f4c20ae7..49c8f63baf 100644 --- a/src/v1_22/api/autoscaling/v2beta1/mod.rs +++ b/src/v1_22/api/autoscaling/v2beta1/mod.rs @@ -16,8 +16,6 @@ pub use self::external_metric_status::ExternalMetricStatus; 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_condition; pub use self::horizontal_pod_autoscaler_condition::HorizontalPodAutoscalerCondition; 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 df7124afd7..77ee3e9293 100644 --- a/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_22/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_22/api/autoscaling/v2beta2/mod.rs b/src/v1_22/api/autoscaling/v2beta2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_22/api/autoscaling/v2beta2/mod.rs +++ b/src/v1_22/api/autoscaling/v2beta2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_22/api/batch/v1/cron_job.rs b/src/v1_22/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_22/api/batch/v1/cron_job.rs +++ b/src/v1_22/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_22/api/batch/v1/job.rs b/src/v1_22/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_22/api/batch/v1/job.rs +++ b/src/v1_22/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_22/api/batch/v1/mod.rs b/src/v1_22/api/batch/v1/mod.rs index 7ea46051db..2d319f9e18 100644 --- a/src/v1_22/api/batch/v1/mod.rs +++ b/src/v1_22/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_22/api/batch/v1beta1/cron_job.rs b/src/v1_22/api/batch/v1beta1/cron_job.rs index 6d31b80fcb..7b61f80131 100644 --- a/src/v1_22/api/batch/v1beta1/cron_job.rs +++ b/src/v1_22/api/batch/v1beta1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { pub status: Option, } -// Begin batch/v1beta1/CronJob - -// Generated from operation createBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 deleteBatchV1beta1CollectionNamespacedCronJob - -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/v1beta1/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 deleteBatchV1beta1NamespacedCronJob - -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/v1beta1/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 listBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 listBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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 readBatchV1beta1NamespacedCronJob - -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/v1beta1/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::v1beta1::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 readBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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::v1beta1::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 replaceBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 replaceBatchV1beta1NamespacedCronJobStatus - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 watchBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 watchBatchV1beta1NamespacedCronJob - -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/v1beta1/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/v1beta1/CronJob - impl crate::Resource for CronJob { const API_VERSION: &'static str = "batch/v1beta1"; const GROUP: &'static str = "batch"; diff --git a/src/v1_22/api/batch/v1beta1/mod.rs b/src/v1_22/api/batch/v1beta1/mod.rs index 3c1c8c9452..554766ce17 100644 --- a/src/v1_22/api/batch/v1beta1/mod.rs +++ b/src/v1_22/api/batch/v1beta1/mod.rs @@ -1,8 +1,6 @@ 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; 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 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_22/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_22/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_22/api/certificates/v1/mod.rs b/src/v1_22/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_22/api/certificates/v1/mod.rs +++ b/src/v1_22/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_22/api/coordination/v1/lease.rs b/src/v1_22/api/coordination/v1/lease.rs index 3e32685cbc..199762cc9a 100644 --- a/src/v1_22/api/coordination/v1/lease.rs +++ b/src/v1_22/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_22/api/coordination/v1/mod.rs b/src/v1_22/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_22/api/coordination/v1/mod.rs +++ b/src/v1_22/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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_22/api/core/v1/binding.rs b/src/v1_22/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_22/api/core/v1/binding.rs +++ b/src/v1_22/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_22/api/core/v1/component_status.rs b/src/v1_22/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_22/api/core/v1/component_status.rs +++ b/src/v1_22/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_22/api/core/v1/config_map.rs b/src/v1_22/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_22/api/core/v1/config_map.rs +++ b/src/v1_22/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_22/api/core/v1/endpoints.rs b/src/v1_22/api/core/v1/endpoints.rs index 7ce1fbc5ba..58ac110ff8 100644 --- a/src/v1_22/api/core/v1/endpoints.rs +++ b/src/v1_22/api/core/v1/endpoints.rs @@ -21,458 +21,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_22/api/core/v1/event.rs b/src/v1_22/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_22/api/core/v1/event.rs +++ b/src/v1_22/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_22/api/core/v1/limit_range.rs b/src/v1_22/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_22/api/core/v1/limit_range.rs +++ b/src/v1_22/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_22/api/core/v1/mod.rs b/src/v1_22/api/core/v1/mod.rs index c119629e17..5508d096eb 100644 --- a/src/v1_22/api/core/v1/mod.rs +++ b/src/v1_22/api/core/v1/mod.rs @@ -49,11 +49,9 @@ 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; @@ -120,7 +118,6 @@ 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; @@ -139,7 +136,6 @@ 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; @@ -203,7 +199,6 @@ pub use self::lifecycle::Lifecycle; 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; @@ -228,8 +223,6 @@ 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; @@ -242,18 +235,6 @@ 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; @@ -299,13 +280,9 @@ 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; @@ -333,26 +310,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -389,7 +346,6 @@ 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; @@ -420,8 +376,6 @@ 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; @@ -437,8 +391,6 @@ 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; @@ -469,7 +421,6 @@ 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; @@ -491,22 +442,9 @@ 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; diff --git a/src/v1_22/api/core/v1/namespace.rs b/src/v1_22/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_22/api/core/v1/namespace.rs +++ b/src/v1_22/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_22/api/core/v1/node.rs b/src/v1_22/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_22/api/core/v1/node.rs +++ b/src/v1_22/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_22/api/core/v1/persistent_volume.rs b/src/v1_22/api/core/v1/persistent_volume.rs index fada89f48e..d8060a6752 100644 --- a/src/v1_22/api/core/v1/persistent_volume.rs +++ b/src/v1_22/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; 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 23ef0c421c..29a96d5be5 100644 --- a/src/v1_22/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_22/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_22/api/core/v1/pod.rs b/src/v1_22/api/core/v1/pod.rs index a24c02fdd4..803af6a12a 100644 --- a/src/v1_22/api/core/v1/pod.rs +++ b/src/v1_22/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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. Defaults to true. - 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. Defaults to true. - 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. Defaults to true. - 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. Defaults to true. - 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 = ""; diff --git a/src/v1_22/api/core/v1/pod_template.rs b/src/v1_22/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_22/api/core/v1/pod_template.rs +++ b/src/v1_22/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_22/api/core/v1/replication_controller.rs b/src/v1_22/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_22/api/core/v1/replication_controller.rs +++ b/src/v1_22/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_22/api/core/v1/resource_quota.rs b/src/v1_22/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_22/api/core/v1/resource_quota.rs +++ b/src/v1_22/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_22/api/core/v1/secret.rs b/src/v1_22/api/core/v1/secret.rs index b94c2afa67..508e602609 100644 --- a/src/v1_22/api/core/v1/secret.rs +++ b/src/v1_22/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_22/api/core/v1/service.rs b/src/v1_22/api/core/v1/service.rs index f21ba2eadd..4add73225c 100644 --- a/src/v1_22/api/core/v1/service.rs +++ b/src/v1_22/api/core/v1/service.rs @@ -13,1121 +13,6 @@ pub struct Service { 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 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 = ""; diff --git a/src/v1_22/api/core/v1/service_account.rs b/src/v1_22/api/core/v1/service_account.rs index c297d5be55..f039a9fbe8 100644 --- a/src/v1_22/api/core/v1/service_account.rs +++ b/src/v1_22/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_22/api/discovery/v1/endpoint_slice.rs b/src/v1_22/api/discovery/v1/endpoint_slice.rs index 1b8cbdf143..f13a66d1ba 100644 --- a/src/v1_22/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_22/api/discovery/v1/endpoint_slice.rs @@ -16,458 +16,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_22/api/discovery/v1/mod.rs b/src/v1_22/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_22/api/discovery/v1/mod.rs +++ b/src/v1_22/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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_22/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs index 12d89081fa..798998e5b7 100644 --- a/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_22/api/discovery/v1beta1/endpoint_slice.rs @@ -16,458 +16,6 @@ pub struct EndpointSlice { pub ports: Option>, } -// Begin discovery.k8s.io/v1beta1/EndpointSlice - -// Generated from operation createDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 deleteDiscoveryV1beta1CollectionNamespacedEndpointSlice - -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/v1beta1/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 deleteDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 listDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 listDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 patchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 readDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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::v1beta1::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 replaceDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 watchDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 watchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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/v1beta1/EndpointSlice - impl crate::Resource for EndpointSlice { const API_VERSION: &'static str = "discovery.k8s.io/v1beta1"; const GROUP: &'static str = "discovery.k8s.io"; diff --git a/src/v1_22/api/discovery/v1beta1/mod.rs b/src/v1_22/api/discovery/v1beta1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_22/api/discovery/v1beta1/mod.rs +++ b/src/v1_22/api/discovery/v1beta1/mod.rs @@ -13,7 +13,6 @@ 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_22/api/events/v1/event.rs b/src/v1_22/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_22/api/events/v1/event.rs +++ b/src/v1_22/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_22/api/events/v1/mod.rs b/src/v1_22/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_22/api/events/v1/mod.rs +++ b/src/v1_22/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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_22/api/events/v1beta1/event.rs b/src/v1_22/api/events/v1beta1/event.rs index c2030320f7..135edd4176 100644 --- a/src/v1_22/api/events/v1beta1/event.rs +++ b/src/v1_22/api/events/v1beta1/event.rs @@ -49,458 +49,6 @@ pub struct Event { pub type_: Option, } -// Begin events.k8s.io/v1beta1/Event - -// Generated from operation createEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 deleteEventsV1beta1CollectionNamespacedEvent - -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/v1beta1/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 deleteEventsV1beta1NamespacedEvent - -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/v1beta1/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 listEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 listEventsV1beta1NamespacedEvent - -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/v1beta1/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 patchEventsV1beta1NamespacedEvent - -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/v1beta1/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 readEventsV1beta1NamespacedEvent - -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/v1beta1/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::v1beta1::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 replaceEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 watchEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 watchEventsV1beta1NamespacedEvent - -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/v1beta1/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/v1beta1/Event - impl crate::Resource for Event { const API_VERSION: &'static str = "events.k8s.io/v1beta1"; const GROUP: &'static str = "events.k8s.io"; diff --git a/src/v1_22/api/events/v1beta1/mod.rs b/src/v1_22/api/events/v1beta1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_22/api/events/v1beta1/mod.rs +++ b/src/v1_22/api/events/v1beta1/mod.rs @@ -1,7 +1,6 @@ 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_22/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs index 1d0546a710..bc2d5f91b1 100644 --- a/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_22/api/flowcontrol/v1beta1/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_22/api/flowcontrol/v1beta1/mod.rs b/src/v1_22/api/flowcontrol/v1beta1/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_22/api/flowcontrol/v1beta1/mod.rs +++ b/src/v1_22/api/flowcontrol/v1beta1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; 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 4cbe999e32..8546c26d30 100644 --- a/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_22/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_22/api/networking/v1/ingress.rs b/src/v1_22/api/networking/v1/ingress.rs index c9e616121f..d97b30d97c 100644 --- a/src/v1_22/api/networking/v1/ingress.rs +++ b/src/v1_22/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_22/api/networking/v1/ingress_class.rs b/src/v1_22/api/networking/v1/ingress_class.rs index d3ab7820c7..c7206cf8f9 100644 --- a/src/v1_22/api/networking/v1/ingress_class.rs +++ b/src/v1_22/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_22/api/networking/v1/mod.rs b/src/v1_22/api/networking/v1/mod.rs index 57e8151751..5949617542 100644 --- a/src/v1_22/api/networking/v1/mod.rs +++ b/src/v1_22/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -43,7 +40,6 @@ pub use self::ingress_tls::IngressTLS; mod network_policy; pub use self::network_policy::NetworkPolicy; -#[cfg(feature = "api")] pub use self::network_policy::ReadNetworkPolicyResponse; mod network_policy_egress_rule; pub use self::network_policy_egress_rule::NetworkPolicyEgressRule; diff --git a/src/v1_22/api/networking/v1/network_policy.rs b/src/v1_22/api/networking/v1/network_policy.rs index e7e2cd8618..daf2122a80 100644 --- a/src/v1_22/api/networking/v1/network_policy.rs +++ b/src/v1_22/api/networking/v1/network_policy.rs @@ -10,458 +10,6 @@ pub struct NetworkPolicy { pub spec: 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 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 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 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"; diff --git a/src/v1_22/api/node/v1/mod.rs b/src/v1_22/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_22/api/node/v1/mod.rs +++ b/src/v1_22/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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_22/api/node/v1/runtime_class.rs b/src/v1_22/api/node/v1/runtime_class.rs index b8b7e6e539..22df0a5837 100644 --- a/src/v1_22/api/node/v1/runtime_class.rs +++ b/src/v1_22/api/node/v1/runtime_class.rs @@ -18,342 +18,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_22/api/node/v1alpha1/mod.rs b/src/v1_22/api/node/v1alpha1/mod.rs index 50b5d5e0b2..d94e5df471 100644 --- a/src/v1_22/api/node/v1alpha1/mod.rs +++ b/src/v1_22/api/node/v1alpha1/mod.rs @@ -4,7 +4,6 @@ pub use self::overhead::Overhead; mod runtime_class; pub use self::runtime_class::RuntimeClass; -#[cfg(feature = "api")] pub use self::runtime_class::ReadRuntimeClassResponse; mod runtime_class_spec; pub use self::runtime_class_spec::RuntimeClassSpec; diff --git a/src/v1_22/api/node/v1alpha1/runtime_class.rs b/src/v1_22/api/node/v1alpha1/runtime_class.rs index 3d28fafe49..087ac57a0f 100644 --- a/src/v1_22/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_22/api/node/v1alpha1/runtime_class.rs @@ -10,342 +10,6 @@ pub struct RuntimeClass { pub spec: crate::api::node::v1alpha1::RuntimeClassSpec, } -// Begin node.k8s.io/v1alpha1/RuntimeClass - -// Generated from operation createNodeV1alpha1RuntimeClass - -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::v1alpha1::RuntimeClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/node.k8s.io/v1alpha1/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 deleteNodeV1alpha1CollectionRuntimeClass - -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/v1alpha1/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 deleteNodeV1alpha1RuntimeClass - -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/v1alpha1/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 listNodeV1alpha1RuntimeClass - -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/v1alpha1/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 patchNodeV1alpha1RuntimeClass - -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/v1alpha1/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 readNodeV1alpha1RuntimeClass - -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/v1alpha1/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::v1alpha1::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 replaceNodeV1alpha1RuntimeClass - -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::v1alpha1::RuntimeClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/node.k8s.io/v1alpha1/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 watchNodeV1alpha1RuntimeClass - -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/v1alpha1/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/v1alpha1/RuntimeClass - impl crate::Resource for RuntimeClass { const API_VERSION: &'static str = "node.k8s.io/v1alpha1"; const GROUP: &'static str = "node.k8s.io"; diff --git a/src/v1_22/api/node/v1beta1/mod.rs b/src/v1_22/api/node/v1beta1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_22/api/node/v1beta1/mod.rs +++ b/src/v1_22/api/node/v1beta1/mod.rs @@ -4,7 +4,6 @@ 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_22/api/node/v1beta1/runtime_class.rs b/src/v1_22/api/node/v1beta1/runtime_class.rs index 9963c70a08..0dc55fa234 100644 --- a/src/v1_22/api/node/v1beta1/runtime_class.rs +++ b/src/v1_22/api/node/v1beta1/runtime_class.rs @@ -16,342 +16,6 @@ pub struct RuntimeClass { pub scheduling: Option, } -// Begin node.k8s.io/v1beta1/RuntimeClass - -// Generated from operation createNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/node.k8s.io/v1beta1/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 deleteNodeV1beta1CollectionRuntimeClass - -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/v1beta1/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 deleteNodeV1beta1RuntimeClass - -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/v1beta1/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 listNodeV1beta1RuntimeClass - -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/v1beta1/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 patchNodeV1beta1RuntimeClass - -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/v1beta1/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 readNodeV1beta1RuntimeClass - -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/v1beta1/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::v1beta1::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 replaceNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/node.k8s.io/v1beta1/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 watchNodeV1beta1RuntimeClass - -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/v1beta1/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/v1beta1/RuntimeClass - impl crate::Resource for RuntimeClass { const API_VERSION: &'static str = "node.k8s.io/v1beta1"; const GROUP: &'static str = "node.k8s.io"; diff --git a/src/v1_22/api/policy/v1/eviction.rs b/src/v1_22/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_22/api/policy/v1/eviction.rs +++ b/src/v1_22/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_22/api/policy/v1/mod.rs b/src/v1_22/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_22/api/policy/v1/mod.rs +++ b/src/v1_22/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; 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 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_22/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_22/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_22/api/policy/v1beta1/mod.rs b/src/v1_22/api/policy/v1beta1/mod.rs index bb4bd412bd..d04299f0b4 100644 --- a/src/v1_22/api/policy/v1beta1/mod.rs +++ b/src/v1_22/api/policy/v1beta1/mod.rs @@ -19,8 +19,6 @@ pub use self::id_range::IDRange; 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; @@ -30,7 +28,6 @@ pub use self::pod_disruption_budget_status::PodDisruptionBudgetStatus; mod pod_security_policy; pub use self::pod_security_policy::PodSecurityPolicy; -#[cfg(feature = "api")] pub use self::pod_security_policy::ReadPodSecurityPolicyResponse; mod pod_security_policy_spec; pub use self::pod_security_policy_spec::PodSecurityPolicySpec; 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 cee96e2f07..610263c049 100644 --- a/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_22/api/policy/v1beta1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct PodDisruptionBudget { pub status: Option, } -// Begin policy/v1beta1/PodDisruptionBudget - -// Generated from operation createPolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 deletePolicyV1beta1CollectionNamespacedPodDisruptionBudget - -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/v1beta1/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 deletePolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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 readPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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::v1beta1::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 readPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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::v1beta1::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 replacePolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 replacePolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 watchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 watchPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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/v1beta1/PodDisruptionBudget - impl crate::Resource for PodDisruptionBudget { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; 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 1a515209d1..66b89ae510 100644 --- a/src/v1_22/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_22/api/policy/v1beta1/pod_security_policy.rs @@ -10,342 +10,6 @@ pub struct PodSecurityPolicy { pub spec: Option, } -// Begin policy/v1beta1/PodSecurityPolicy - -// Generated from operation createPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// create a PodSecurityPolicy - /// - /// 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::policy::v1beta1::PodSecurityPolicy, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1CollectionPodSecurityPolicy - -impl PodSecurityPolicy { - /// delete collection of PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// delete a PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 listPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 patchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// partially update the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 readPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// read the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSecurityPolicyResponse`]`>` constructor, or [`ReadPodSecurityPolicyResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - #[cfg(feature = "api")] - pub fn read( - name: &str, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 [`PodSecurityPolicy::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSecurityPolicyResponse { - Ok(crate::api::policy::v1beta1::PodSecurityPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSecurityPolicyResponse { - 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((ReadPodSecurityPolicyResponse::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((ReadPodSecurityPolicyResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replacePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// replace the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::policy::v1beta1::PodSecurityPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 watchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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/v1beta1/PodSecurityPolicy - impl crate::Resource for PodSecurityPolicy { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; diff --git a/src/v1_22/api/rbac/v1/cluster_role.rs b/src/v1_22/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_22/api/rbac/v1/cluster_role.rs +++ b/src/v1_22/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; 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 04fa2bd714..f35ae335c2 100644 --- a/src/v1_22/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_22/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_22/api/rbac/v1/mod.rs b/src/v1_22/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_22/api/rbac/v1/mod.rs +++ b/src/v1_22/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_22/api/rbac/v1/role.rs b/src/v1_22/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_22/api/rbac/v1/role.rs +++ b/src/v1_22/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_22/api/rbac/v1/role_binding.rs b/src/v1_22/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_22/api/rbac/v1/role_binding.rs +++ b/src/v1_22/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_22/api/rbac/v1alpha1/cluster_role.rs b/src/v1_22/api/rbac/v1alpha1/cluster_role.rs index 1894462873..fe9482e510 100644 --- a/src/v1_22/api/rbac/v1alpha1/cluster_role.rs +++ b/src/v1_22/api/rbac/v1alpha1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct ClusterRole { pub rules: Option>, } -// Begin rbac.authorization.k8s.io/v1alpha1/ClusterRole - -// Generated from operation createRbacAuthorizationV1alpha1ClusterRole - -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::v1alpha1::ClusterRole, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/rbac.authorization.k8s.io/v1alpha1/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 deleteRbacAuthorizationV1alpha1ClusterRole - -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/v1alpha1/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 deleteRbacAuthorizationV1alpha1CollectionClusterRole - -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/v1alpha1/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 listRbacAuthorizationV1alpha1ClusterRole - -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/v1alpha1/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 patchRbacAuthorizationV1alpha1ClusterRole - -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/v1alpha1/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 readRbacAuthorizationV1alpha1ClusterRole - -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/v1alpha1/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::v1alpha1::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 replaceRbacAuthorizationV1alpha1ClusterRole - -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::v1alpha1::ClusterRole, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 watchRbacAuthorizationV1alpha1ClusterRole - -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/v1alpha1/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/v1alpha1/ClusterRole - impl crate::Resource for ClusterRole { const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1alpha1"; const GROUP: &'static str = "rbac.authorization.k8s.io"; 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 9385e93337..904ff0c566 100644 --- a/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs +++ b/src/v1_22/api/rbac/v1alpha1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { pub subjects: Option>, } -// Begin rbac.authorization.k8s.io/v1alpha1/ClusterRoleBinding - -// Generated from operation createRbacAuthorizationV1alpha1ClusterRoleBinding - -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::v1alpha1::ClusterRoleBinding, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/rbac.authorization.k8s.io/v1alpha1/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 deleteRbacAuthorizationV1alpha1ClusterRoleBinding - -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/v1alpha1/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 deleteRbacAuthorizationV1alpha1CollectionClusterRoleBinding - -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/v1alpha1/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 listRbacAuthorizationV1alpha1ClusterRoleBinding - -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/v1alpha1/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 patchRbacAuthorizationV1alpha1ClusterRoleBinding - -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/v1alpha1/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 readRbacAuthorizationV1alpha1ClusterRoleBinding - -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/v1alpha1/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::v1alpha1::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 replaceRbacAuthorizationV1alpha1ClusterRoleBinding - -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::v1alpha1::ClusterRoleBinding, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 watchRbacAuthorizationV1alpha1ClusterRoleBinding - -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/v1alpha1/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/v1alpha1/ClusterRoleBinding - impl crate::Resource for ClusterRoleBinding { const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1alpha1"; const GROUP: &'static str = "rbac.authorization.k8s.io"; diff --git a/src/v1_22/api/rbac/v1alpha1/mod.rs b/src/v1_22/api/rbac/v1alpha1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_22/api/rbac/v1alpha1/mod.rs +++ b/src/v1_22/api/rbac/v1alpha1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_22/api/rbac/v1alpha1/role.rs b/src/v1_22/api/rbac/v1alpha1/role.rs index a21e1d75e2..00a514576b 100644 --- a/src/v1_22/api/rbac/v1alpha1/role.rs +++ b/src/v1_22/api/rbac/v1alpha1/role.rs @@ -10,458 +10,6 @@ pub struct Role { pub rules: Option>, } -// Begin rbac.authorization.k8s.io/v1alpha1/Role - -// Generated from operation createRbacAuthorizationV1alpha1NamespacedRole - -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::v1alpha1::Role, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 deleteRbacAuthorizationV1alpha1CollectionNamespacedRole - -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/v1alpha1/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 deleteRbacAuthorizationV1alpha1NamespacedRole - -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/v1alpha1/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 listRbacAuthorizationV1alpha1NamespacedRole - -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/v1alpha1/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 listRbacAuthorizationV1alpha1RoleForAllNamespaces - -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/v1alpha1/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 patchRbacAuthorizationV1alpha1NamespacedRole - -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/v1alpha1/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 readRbacAuthorizationV1alpha1NamespacedRole - -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/v1alpha1/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::v1alpha1::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 replaceRbacAuthorizationV1alpha1NamespacedRole - -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::v1alpha1::Role, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 watchRbacAuthorizationV1alpha1NamespacedRole - -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/v1alpha1/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 watchRbacAuthorizationV1alpha1RoleForAllNamespaces - -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/v1alpha1/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/v1alpha1/Role - impl crate::Resource for Role { const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1alpha1"; const GROUP: &'static str = "rbac.authorization.k8s.io"; diff --git a/src/v1_22/api/rbac/v1alpha1/role_binding.rs b/src/v1_22/api/rbac/v1alpha1/role_binding.rs index 819c0b88f2..5f9211e12d 100644 --- a/src/v1_22/api/rbac/v1alpha1/role_binding.rs +++ b/src/v1_22/api/rbac/v1alpha1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { pub subjects: Option>, } -// Begin rbac.authorization.k8s.io/v1alpha1/RoleBinding - -// Generated from operation createRbacAuthorizationV1alpha1NamespacedRoleBinding - -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::v1alpha1::RoleBinding, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 deleteRbacAuthorizationV1alpha1CollectionNamespacedRoleBinding - -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/v1alpha1/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 deleteRbacAuthorizationV1alpha1NamespacedRoleBinding - -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/v1alpha1/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 listRbacAuthorizationV1alpha1NamespacedRoleBinding - -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/v1alpha1/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 listRbacAuthorizationV1alpha1RoleBindingForAllNamespaces - -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/v1alpha1/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 patchRbacAuthorizationV1alpha1NamespacedRoleBinding - -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/v1alpha1/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 readRbacAuthorizationV1alpha1NamespacedRoleBinding - -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/v1alpha1/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::v1alpha1::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 replaceRbacAuthorizationV1alpha1NamespacedRoleBinding - -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::v1alpha1::RoleBinding, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/rbac.authorization.k8s.io/v1alpha1/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 watchRbacAuthorizationV1alpha1NamespacedRoleBinding - -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/v1alpha1/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 watchRbacAuthorizationV1alpha1RoleBindingForAllNamespaces - -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/v1alpha1/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/v1alpha1/RoleBinding - impl crate::Resource for RoleBinding { const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1alpha1"; const GROUP: &'static str = "rbac.authorization.k8s.io"; diff --git a/src/v1_22/api/scheduling/v1/mod.rs b/src/v1_22/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_22/api/scheduling/v1/mod.rs +++ b/src/v1_22/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_22/api/scheduling/v1/priority_class.rs b/src/v1_22/api/scheduling/v1/priority_class.rs index a7dba60fbd..62a111951c 100644 --- a/src/v1_22/api/scheduling/v1/priority_class.rs +++ b/src/v1_22/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_22/api/scheduling/v1alpha1/mod.rs b/src/v1_22/api/scheduling/v1alpha1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_22/api/scheduling/v1alpha1/mod.rs +++ b/src/v1_22/api/scheduling/v1alpha1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_22/api/scheduling/v1alpha1/priority_class.rs b/src/v1_22/api/scheduling/v1alpha1/priority_class.rs index 992756ff0f..9d4f212da0 100644 --- a/src/v1_22/api/scheduling/v1alpha1/priority_class.rs +++ b/src/v1_22/api/scheduling/v1alpha1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { pub value: i32, } -// Begin scheduling.k8s.io/v1alpha1/PriorityClass - -// Generated from operation createSchedulingV1alpha1PriorityClass - -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::v1alpha1::PriorityClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/scheduling.k8s.io/v1alpha1/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 deleteSchedulingV1alpha1CollectionPriorityClass - -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/v1alpha1/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 deleteSchedulingV1alpha1PriorityClass - -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/v1alpha1/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 listSchedulingV1alpha1PriorityClass - -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/v1alpha1/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 patchSchedulingV1alpha1PriorityClass - -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/v1alpha1/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 readSchedulingV1alpha1PriorityClass - -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/v1alpha1/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::v1alpha1::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 replaceSchedulingV1alpha1PriorityClass - -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::v1alpha1::PriorityClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/scheduling.k8s.io/v1alpha1/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 watchSchedulingV1alpha1PriorityClass - -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/v1alpha1/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/v1alpha1/PriorityClass - impl crate::Resource for PriorityClass { const API_VERSION: &'static str = "scheduling.k8s.io/v1alpha1"; const GROUP: &'static str = "scheduling.k8s.io"; diff --git a/src/v1_22/api/storage/v1/csi_driver.rs b/src/v1_22/api/storage/v1/csi_driver.rs index 0dc419fa28..b9bf9360f9 100644 --- a/src/v1_22/api/storage/v1/csi_driver.rs +++ b/src/v1_22/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_22/api/storage/v1/csi_node.rs b/src/v1_22/api/storage/v1/csi_node.rs index a514ce9bf0..92674e4267 100644 --- a/src/v1_22/api/storage/v1/csi_node.rs +++ b/src/v1_22/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; diff --git a/src/v1_22/api/storage/v1/mod.rs b/src/v1_22/api/storage/v1/mod.rs index 70c75595b0..d6c4e85b69 100644 --- a/src/v1_22/api/storage/v1/mod.rs +++ b/src/v1_22/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,15 +16,12 @@ pub use self::csi_node_spec::CSINodeSpec; 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; diff --git a/src/v1_22/api/storage/v1/storage_class.rs b/src/v1_22/api/storage/v1/storage_class.rs index 12774ba320..1b39f75ad7 100644 --- a/src/v1_22/api/storage/v1/storage_class.rs +++ b/src/v1_22/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_22/api/storage/v1/volume_attachment.rs b/src/v1_22/api/storage/v1/volume_attachment.rs index f6b6972639..624ab4dbe0 100644 --- a/src/v1_22/api/storage/v1/volume_attachment.rs +++ b/src/v1_22/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; 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 5d4e7656c1..b23ef6ffae 100644 --- a/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs +++ b/src/v1_22/api/storage/v1alpha1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { pub storage_class_name: String, } -// Begin storage.k8s.io/v1alpha1/CSIStorageCapacity - -// Generated from operation createStorageV1alpha1NamespacedCSIStorageCapacity - -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::v1alpha1::CSIStorageCapacity, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/storage.k8s.io/v1alpha1/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 deleteStorageV1alpha1CollectionNamespacedCSIStorageCapacity - -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/v1alpha1/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 deleteStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 listStorageV1alpha1CSIStorageCapacityForAllNamespaces - -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/v1alpha1/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 listStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 patchStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 readStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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::v1alpha1::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 replaceStorageV1alpha1NamespacedCSIStorageCapacity - -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::v1alpha1::CSIStorageCapacity, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/storage.k8s.io/v1alpha1/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 watchStorageV1alpha1CSIStorageCapacityForAllNamespaces - -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/v1alpha1/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 watchStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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/v1alpha1/CSIStorageCapacity - impl crate::Resource for CSIStorageCapacity { const API_VERSION: &'static str = "storage.k8s.io/v1alpha1"; const GROUP: &'static str = "storage.k8s.io"; diff --git a/src/v1_22/api/storage/v1alpha1/mod.rs b/src/v1_22/api/storage/v1alpha1/mod.rs index 559a5ac81c..0b071a74d3 100644 --- a/src/v1_22/api/storage/v1alpha1/mod.rs +++ b/src/v1_22/api/storage/v1alpha1/mod.rs @@ -1,11 +1,9 @@ mod csi_storage_capacity; pub use self::csi_storage_capacity::CSIStorageCapacity; -#[cfg(feature = "api")] pub use self::csi_storage_capacity::ReadCSIStorageCapacityResponse; mod volume_attachment; pub use self::volume_attachment::VolumeAttachment; -#[cfg(feature = "api")] pub use self::volume_attachment::ReadVolumeAttachmentResponse; mod volume_attachment_source; pub use self::volume_attachment_source::VolumeAttachmentSource; diff --git a/src/v1_22/api/storage/v1alpha1/volume_attachment.rs b/src/v1_22/api/storage/v1alpha1/volume_attachment.rs index 650e9a415f..c3ae352d12 100644 --- a/src/v1_22/api/storage/v1alpha1/volume_attachment.rs +++ b/src/v1_22/api/storage/v1alpha1/volume_attachment.rs @@ -15,342 +15,6 @@ pub struct VolumeAttachment { pub status: Option, } -// Begin storage.k8s.io/v1alpha1/VolumeAttachment - -// Generated from operation createStorageV1alpha1VolumeAttachment - -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::v1alpha1::VolumeAttachment, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/storage.k8s.io/v1alpha1/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 deleteStorageV1alpha1CollectionVolumeAttachment - -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/v1alpha1/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 deleteStorageV1alpha1VolumeAttachment - -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/v1alpha1/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 listStorageV1alpha1VolumeAttachment - -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/v1alpha1/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 patchStorageV1alpha1VolumeAttachment - -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/v1alpha1/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 readStorageV1alpha1VolumeAttachment - -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/v1alpha1/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::v1alpha1::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 replaceStorageV1alpha1VolumeAttachment - -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::v1alpha1::VolumeAttachment, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/storage.k8s.io/v1alpha1/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 watchStorageV1alpha1VolumeAttachment - -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/v1alpha1/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/v1alpha1/VolumeAttachment - impl crate::Resource for VolumeAttachment { const API_VERSION: &'static str = "storage.k8s.io/v1alpha1"; const GROUP: &'static str = "storage.k8s.io"; 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 f3b5e51d4d..1e2b135a25 100644 --- a/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_22/api/storage/v1beta1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_22/api/storage/v1beta1/mod.rs b/src/v1_22/api/storage/v1beta1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_22/api/storage/v1beta1/mod.rs +++ b/src/v1_22/api/storage/v1beta1/mod.rs @@ -1,4 +1,3 @@ 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_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 c05e8ea174..be33903b77 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 @@ -13,495 +13,6 @@ pub struct 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"; diff --git a/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs index a8dbe15f6a..2a01dbc19b 100644 --- a/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_22/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_22/create_optional.rs b/src/v1_22/create_optional.rs deleted file mode 100644 index 4e4fc61c26..0000000000 --- a/src/v1_22/create_optional.rs +++ /dev/null @@ -1,31 +0,0 @@ -// 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>, -} - -#[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); - } - } -} diff --git a/src/v1_22/create_response.rs b/src/v1_22/create_response.rs deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_22/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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_22/delete_optional.rs b/src/v1_22/delete_optional.rs deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_22/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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_22/delete_response.rs b/src/v1_22/delete_response.rs deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_22/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 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 @@ -13,495 +13,6 @@ pub struct APIService { 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"; diff --git a/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs index e48afb5807..57d836af46 100644 --- a/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_22/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_22/list_optional.rs b/src/v1_22/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_22/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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_22/list_response.rs b/src/v1_22/list_response.rs deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_22/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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_22/mod.rs b/src/v1_22/mod.rs index c8e1c51281..27088faf3b 100644 --- a/src/v1_22/mod.rs +++ b/src/v1_22/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,3370 +9,3 @@ 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 getAutoscalingV2beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV2beta1APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV2beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_autoscaling_v2beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/autoscaling/v2beta1/".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_v2beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAutoscalingV2beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAutoscalingV2beta1APIResourcesResponse { - 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((GetAutoscalingV2beta1APIResourcesResponse::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((GetAutoscalingV2beta1APIResourcesResponse::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 getBatchV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetBatchV1beta1APIResourcesResponse`]`>` constructor, or [`GetBatchV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_batch_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/batch/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_batch_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetBatchV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetBatchV1beta1APIResourcesResponse { - 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((GetBatchV1beta1APIResourcesResponse::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((GetBatchV1beta1APIResourcesResponse::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 getDiscoveryV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetDiscoveryV1beta1APIResourcesResponse`]`>` constructor, or [`GetDiscoveryV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_discovery_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/discovery.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_discovery_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetDiscoveryV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetDiscoveryV1beta1APIResourcesResponse { - 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((GetDiscoveryV1beta1APIResourcesResponse::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((GetDiscoveryV1beta1APIResourcesResponse::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 getEventsV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetEventsV1beta1APIResourcesResponse`]`>` constructor, or [`GetEventsV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_events_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/events.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_events_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetEventsV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetEventsV1beta1APIResourcesResponse { - 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((GetEventsV1beta1APIResourcesResponse::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((GetEventsV1beta1APIResourcesResponse::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 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 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 getNodeV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1alpha1APIResourcesResponse`]`>` constructor, or [`GetNodeV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_node_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/node.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_node_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetNodeV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetNodeV1alpha1APIResourcesResponse { - 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((GetNodeV1alpha1APIResourcesResponse::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((GetNodeV1alpha1APIResourcesResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation getNodeV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1beta1APIResourcesResponse`]`>` constructor, or [`GetNodeV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_node_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/node.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_node_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetNodeV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetNodeV1beta1APIResourcesResponse { - 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((GetNodeV1beta1APIResourcesResponse::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((GetNodeV1beta1APIResourcesResponse::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 getPolicyV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetPolicyV1beta1APIResourcesResponse`]`>` constructor, or [`GetPolicyV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_policy_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/policy/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_policy_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetPolicyV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetPolicyV1beta1APIResourcesResponse { - 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((GetPolicyV1beta1APIResourcesResponse::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((GetPolicyV1beta1APIResourcesResponse::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 getRbacAuthorizationV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetRbacAuthorizationV1alpha1APIResourcesResponse`]`>` constructor, or [`GetRbacAuthorizationV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_rbac_authorization_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/rbac.authorization.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_rbac_authorization_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetRbacAuthorizationV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetRbacAuthorizationV1alpha1APIResourcesResponse { - 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((GetRbacAuthorizationV1alpha1APIResourcesResponse::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((GetRbacAuthorizationV1alpha1APIResourcesResponse::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 getSchedulingV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetSchedulingV1alpha1APIResourcesResponse`]`>` constructor, or [`GetSchedulingV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_scheduling_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/scheduling.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_scheduling_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetSchedulingV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetSchedulingV1alpha1APIResourcesResponse { - 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((GetSchedulingV1alpha1APIResourcesResponse::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((GetSchedulingV1alpha1APIResourcesResponse::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 getStorageV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetStorageV1alpha1APIResourcesResponse`]`>` constructor, or [`GetStorageV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_storage_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/storage.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_storage_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetStorageV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetStorageV1alpha1APIResourcesResponse { - 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((GetStorageV1alpha1APIResourcesResponse::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((GetStorageV1alpha1APIResourcesResponse::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_22/patch_optional.rs b/src/v1_22/patch_optional.rs deleted file mode 100644 index 54959d806b..0000000000 --- a/src/v1_22/patch_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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>, - - /// 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.force { - __query_pairs.append_pair("force", if value { "true" } else { "false" }); - } - } -} diff --git a/src/v1_22/patch_response.rs b/src/v1_22/patch_response.rs deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_22/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_22/replace_optional.rs b/src/v1_22/replace_optional.rs deleted file mode 100644 index 41f9961c7d..0000000000 --- a/src/v1_22/replace_optional.rs +++ /dev/null @@ -1,31 +0,0 @@ -// 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>, -} - -#[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); - } - } -} diff --git a/src/v1_22/replace_response.rs b/src/v1_22/replace_response.rs deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_22/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_22/watch_optional.rs b/src/v1_22/watch_optional.rs deleted file mode 100644 index cf0ebe7300..0000000000 --- a/src/v1_22/watch_optional.rs +++ /dev/null @@ -1,60 +0,0 @@ -// 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>, - - /// 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> 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", 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_22/watch_response.rs b/src/v1_22/watch_response.rs deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_22/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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/src/v1_23/api/admissionregistration/v1/mod.rs b/src/v1_23/api/admissionregistration/v1/mod.rs index ace31fe7fb..4b1bbcbd9c 100644 --- a/src/v1_23/api/admissionregistration/v1/mod.rs +++ b/src/v1_23/api/admissionregistration/v1/mod.rs @@ -4,7 +4,6 @@ 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; @@ -17,7 +16,6 @@ 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_23/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_23/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; 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 ff20990424..f188208c4d 100644 --- a/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_23/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_23/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_23/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_23/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_23/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs index c5d811a2fd..447818b5bf 100644 --- a/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_23/api/apiserverinternal/v1alpha1/storage_version.rs @@ -13,495 +13,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_23/api/apps/v1/controller_revision.rs b/src/v1_23/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_23/api/apps/v1/controller_revision.rs +++ b/src/v1_23/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_23/api/apps/v1/daemon_set.rs b/src/v1_23/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_23/api/apps/v1/daemon_set.rs +++ b/src/v1_23/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_23/api/apps/v1/deployment.rs b/src/v1_23/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_23/api/apps/v1/deployment.rs +++ b/src/v1_23/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_23/api/apps/v1/mod.rs b/src/v1_23/api/apps/v1/mod.rs index 9b0d98c82d..8ccdb8295f 100644 --- a/src/v1_23/api/apps/v1/mod.rs +++ b/src/v1_23/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_23/api/apps/v1/replica_set.rs b/src/v1_23/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_23/api/apps/v1/replica_set.rs +++ b/src/v1_23/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_23/api/apps/v1/stateful_set.rs b/src/v1_23/api/apps/v1/stateful_set.rs index 513df14954..d7a358f132 100644 --- a/src/v1_23/api/apps/v1/stateful_set.rs +++ b/src/v1_23/api/apps/v1/stateful_set.rs @@ -17,629 +17,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_23/api/authentication/v1/token_request.rs b/src/v1_23/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_23/api/authentication/v1/token_request.rs +++ b/src/v1_23/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_23/api/authentication/v1/token_review.rs b/src/v1_23/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_23/api/authentication/v1/token_review.rs +++ b/src/v1_23/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; diff --git a/src/v1_23/api/authorization/v1/local_subject_access_review.rs b/src/v1_23/api/authorization/v1/local_subject_access_review.rs index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_23/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_23/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; diff --git a/src/v1_23/api/authorization/v1/self_subject_access_review.rs b/src/v1_23/api/authorization/v1/self_subject_access_review.rs index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_23/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_23/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; diff --git a/src/v1_23/api/authorization/v1/self_subject_rules_review.rs b/src/v1_23/api/authorization/v1/self_subject_rules_review.rs index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_23/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_23/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_23/api/authorization/v1/subject_access_review.rs b/src/v1_23/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_23/api/authorization/v1/subject_access_review.rs +++ b/src/v1_23/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; 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 01ee0ebcfc..79156137f7 100644 --- a/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_23/api/autoscaling/v1/mod.rs b/src/v1_23/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_23/api/autoscaling/v1/mod.rs +++ b/src/v1_23/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_23/api/autoscaling/v1/scale.rs b/src/v1_23/api/autoscaling/v1/scale.rs index 89a7024529..8e96f95929 100644 --- a/src/v1_23/api/autoscaling/v1/scale.rs +++ b/src/v1_23/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; 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 e3df4c800c..e60e51dc10 100644 --- a/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_23/api/autoscaling/v2/mod.rs b/src/v1_23/api/autoscaling/v2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_23/api/autoscaling/v2/mod.rs +++ b/src/v1_23/api/autoscaling/v2/mod.rs @@ -22,8 +22,6 @@ 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; 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 50b9970024..8ba3951299 100644 --- a/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { pub status: Option, } -// Begin autoscaling/v2beta1/HorizontalPodAutoscaler - -// Generated from operation createAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 deleteAutoscalingV2beta1CollectionNamespacedHorizontalPodAutoscaler - -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/v2beta1/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 deleteAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 listAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 listAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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::v2beta1::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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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::v2beta1::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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 watchAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 watchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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/v2beta1/HorizontalPodAutoscaler - impl crate::Resource for HorizontalPodAutoscaler { const API_VERSION: &'static str = "autoscaling/v2beta1"; const GROUP: &'static str = "autoscaling"; diff --git a/src/v1_23/api/autoscaling/v2beta1/mod.rs b/src/v1_23/api/autoscaling/v2beta1/mod.rs index c4f4c20ae7..49c8f63baf 100644 --- a/src/v1_23/api/autoscaling/v2beta1/mod.rs +++ b/src/v1_23/api/autoscaling/v2beta1/mod.rs @@ -16,8 +16,6 @@ pub use self::external_metric_status::ExternalMetricStatus; 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_condition; pub use self::horizontal_pod_autoscaler_condition::HorizontalPodAutoscalerCondition; 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 df7124afd7..77ee3e9293 100644 --- a/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_23/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_23/api/autoscaling/v2beta2/mod.rs b/src/v1_23/api/autoscaling/v2beta2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_23/api/autoscaling/v2beta2/mod.rs +++ b/src/v1_23/api/autoscaling/v2beta2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_23/api/batch/v1/cron_job.rs b/src/v1_23/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_23/api/batch/v1/cron_job.rs +++ b/src/v1_23/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_23/api/batch/v1/job.rs b/src/v1_23/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_23/api/batch/v1/job.rs +++ b/src/v1_23/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_23/api/batch/v1/mod.rs b/src/v1_23/api/batch/v1/mod.rs index 7ea46051db..2d319f9e18 100644 --- a/src/v1_23/api/batch/v1/mod.rs +++ b/src/v1_23/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_23/api/batch/v1beta1/cron_job.rs b/src/v1_23/api/batch/v1beta1/cron_job.rs index 6d31b80fcb..7b61f80131 100644 --- a/src/v1_23/api/batch/v1beta1/cron_job.rs +++ b/src/v1_23/api/batch/v1beta1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { pub status: Option, } -// Begin batch/v1beta1/CronJob - -// Generated from operation createBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 deleteBatchV1beta1CollectionNamespacedCronJob - -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/v1beta1/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 deleteBatchV1beta1NamespacedCronJob - -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/v1beta1/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 listBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 listBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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 readBatchV1beta1NamespacedCronJob - -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/v1beta1/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::v1beta1::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 readBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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::v1beta1::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 replaceBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 replaceBatchV1beta1NamespacedCronJobStatus - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 watchBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 watchBatchV1beta1NamespacedCronJob - -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/v1beta1/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/v1beta1/CronJob - impl crate::Resource for CronJob { const API_VERSION: &'static str = "batch/v1beta1"; const GROUP: &'static str = "batch"; diff --git a/src/v1_23/api/batch/v1beta1/mod.rs b/src/v1_23/api/batch/v1beta1/mod.rs index 3c1c8c9452..554766ce17 100644 --- a/src/v1_23/api/batch/v1beta1/mod.rs +++ b/src/v1_23/api/batch/v1beta1/mod.rs @@ -1,8 +1,6 @@ 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; 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 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_23/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_23/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_23/api/certificates/v1/mod.rs b/src/v1_23/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_23/api/certificates/v1/mod.rs +++ b/src/v1_23/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_23/api/coordination/v1/lease.rs b/src/v1_23/api/coordination/v1/lease.rs index 3e32685cbc..199762cc9a 100644 --- a/src/v1_23/api/coordination/v1/lease.rs +++ b/src/v1_23/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_23/api/coordination/v1/mod.rs b/src/v1_23/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_23/api/coordination/v1/mod.rs +++ b/src/v1_23/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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_23/api/core/v1/binding.rs b/src/v1_23/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_23/api/core/v1/binding.rs +++ b/src/v1_23/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_23/api/core/v1/component_status.rs b/src/v1_23/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_23/api/core/v1/component_status.rs +++ b/src/v1_23/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_23/api/core/v1/config_map.rs b/src/v1_23/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_23/api/core/v1/config_map.rs +++ b/src/v1_23/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_23/api/core/v1/endpoints.rs b/src/v1_23/api/core/v1/endpoints.rs index 74d95ffd83..3cb5e56421 100644 --- a/src/v1_23/api/core/v1/endpoints.rs +++ b/src/v1_23/api/core/v1/endpoints.rs @@ -22,458 +22,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_23/api/core/v1/event.rs b/src/v1_23/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_23/api/core/v1/event.rs +++ b/src/v1_23/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_23/api/core/v1/limit_range.rs b/src/v1_23/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_23/api/core/v1/limit_range.rs +++ b/src/v1_23/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_23/api/core/v1/mod.rs b/src/v1_23/api/core/v1/mod.rs index f8cee71f8e..cc8980d154 100644 --- a/src/v1_23/api/core/v1/mod.rs +++ b/src/v1_23/api/core/v1/mod.rs @@ -49,11 +49,9 @@ 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; @@ -120,7 +118,6 @@ 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; @@ -139,7 +136,6 @@ 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; @@ -206,7 +202,6 @@ 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; @@ -231,8 +226,6 @@ 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; @@ -245,18 +238,6 @@ 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; @@ -302,13 +283,9 @@ 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; @@ -336,26 +313,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -395,7 +352,6 @@ 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; @@ -426,8 +382,6 @@ 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; @@ -443,8 +397,6 @@ 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; @@ -475,7 +427,6 @@ 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; @@ -497,22 +448,9 @@ 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; diff --git a/src/v1_23/api/core/v1/namespace.rs b/src/v1_23/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_23/api/core/v1/namespace.rs +++ b/src/v1_23/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_23/api/core/v1/node.rs b/src/v1_23/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_23/api/core/v1/node.rs +++ b/src/v1_23/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_23/api/core/v1/persistent_volume.rs b/src/v1_23/api/core/v1/persistent_volume.rs index fada89f48e..d8060a6752 100644 --- a/src/v1_23/api/core/v1/persistent_volume.rs +++ b/src/v1_23/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; 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 23ef0c421c..29a96d5be5 100644 --- a/src/v1_23/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_23/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_23/api/core/v1/pod.rs b/src/v1_23/api/core/v1/pod.rs index f99a63faa1..803af6a12a 100644 --- a/src/v1_23/api/core/v1/pod.rs +++ b/src/v1_23/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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 = ""; diff --git a/src/v1_23/api/core/v1/pod_template.rs b/src/v1_23/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_23/api/core/v1/pod_template.rs +++ b/src/v1_23/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_23/api/core/v1/replication_controller.rs b/src/v1_23/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_23/api/core/v1/replication_controller.rs +++ b/src/v1_23/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_23/api/core/v1/resource_quota.rs b/src/v1_23/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_23/api/core/v1/resource_quota.rs +++ b/src/v1_23/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_23/api/core/v1/secret.rs b/src/v1_23/api/core/v1/secret.rs index eb75155e0d..4c93df7798 100644 --- a/src/v1_23/api/core/v1/secret.rs +++ b/src/v1_23/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_23/api/core/v1/service.rs b/src/v1_23/api/core/v1/service.rs index d5b201c7a6..4add73225c 100644 --- a/src/v1_23/api/core/v1/service.rs +++ b/src/v1_23/api/core/v1/service.rs @@ -13,1169 +13,6 @@ pub struct Service { 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 = ""; diff --git a/src/v1_23/api/core/v1/service_account.rs b/src/v1_23/api/core/v1/service_account.rs index c297d5be55..f039a9fbe8 100644 --- a/src/v1_23/api/core/v1/service_account.rs +++ b/src/v1_23/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_23/api/discovery/v1/endpoint_slice.rs b/src/v1_23/api/discovery/v1/endpoint_slice.rs index 033c1c4e60..ee595d764c 100644 --- a/src/v1_23/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_23/api/discovery/v1/endpoint_slice.rs @@ -17,458 +17,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_23/api/discovery/v1/mod.rs b/src/v1_23/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_23/api/discovery/v1/mod.rs +++ b/src/v1_23/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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_23/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs index 12d89081fa..798998e5b7 100644 --- a/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_23/api/discovery/v1beta1/endpoint_slice.rs @@ -16,458 +16,6 @@ pub struct EndpointSlice { pub ports: Option>, } -// Begin discovery.k8s.io/v1beta1/EndpointSlice - -// Generated from operation createDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 deleteDiscoveryV1beta1CollectionNamespacedEndpointSlice - -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/v1beta1/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 deleteDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 listDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 listDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 patchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 readDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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::v1beta1::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 replaceDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 watchDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 watchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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/v1beta1/EndpointSlice - impl crate::Resource for EndpointSlice { const API_VERSION: &'static str = "discovery.k8s.io/v1beta1"; const GROUP: &'static str = "discovery.k8s.io"; diff --git a/src/v1_23/api/discovery/v1beta1/mod.rs b/src/v1_23/api/discovery/v1beta1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_23/api/discovery/v1beta1/mod.rs +++ b/src/v1_23/api/discovery/v1beta1/mod.rs @@ -13,7 +13,6 @@ 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_23/api/events/v1/event.rs b/src/v1_23/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_23/api/events/v1/event.rs +++ b/src/v1_23/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_23/api/events/v1/mod.rs b/src/v1_23/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_23/api/events/v1/mod.rs +++ b/src/v1_23/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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_23/api/events/v1beta1/event.rs b/src/v1_23/api/events/v1beta1/event.rs index c2030320f7..135edd4176 100644 --- a/src/v1_23/api/events/v1beta1/event.rs +++ b/src/v1_23/api/events/v1beta1/event.rs @@ -49,458 +49,6 @@ pub struct Event { pub type_: Option, } -// Begin events.k8s.io/v1beta1/Event - -// Generated from operation createEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 deleteEventsV1beta1CollectionNamespacedEvent - -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/v1beta1/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 deleteEventsV1beta1NamespacedEvent - -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/v1beta1/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 listEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 listEventsV1beta1NamespacedEvent - -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/v1beta1/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 patchEventsV1beta1NamespacedEvent - -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/v1beta1/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 readEventsV1beta1NamespacedEvent - -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/v1beta1/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::v1beta1::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 replaceEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 watchEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 watchEventsV1beta1NamespacedEvent - -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/v1beta1/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/v1beta1/Event - impl crate::Resource for Event { const API_VERSION: &'static str = "events.k8s.io/v1beta1"; const GROUP: &'static str = "events.k8s.io"; diff --git a/src/v1_23/api/events/v1beta1/mod.rs b/src/v1_23/api/events/v1beta1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_23/api/events/v1beta1/mod.rs +++ b/src/v1_23/api/events/v1beta1/mod.rs @@ -1,7 +1,6 @@ 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_23/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs index 1d0546a710..bc2d5f91b1 100644 --- a/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_23/api/flowcontrol/v1beta1/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_23/api/flowcontrol/v1beta1/mod.rs b/src/v1_23/api/flowcontrol/v1beta1/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_23/api/flowcontrol/v1beta1/mod.rs +++ b/src/v1_23/api/flowcontrol/v1beta1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; 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 4cbe999e32..8546c26d30 100644 --- a/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_23/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs index 71d13230a3..bb9f5a3a92 100644 --- a/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_23/api/flowcontrol/v1beta2/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_23/api/flowcontrol/v1beta2/mod.rs b/src/v1_23/api/flowcontrol/v1beta2/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_23/api/flowcontrol/v1beta2/mod.rs +++ b/src/v1_23/api/flowcontrol/v1beta2/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; 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 91ebc9f1f5..2f8bb6a7cc 100644 --- a/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_23/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_23/api/networking/v1/ingress.rs b/src/v1_23/api/networking/v1/ingress.rs index c9e616121f..d97b30d97c 100644 --- a/src/v1_23/api/networking/v1/ingress.rs +++ b/src/v1_23/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_23/api/networking/v1/ingress_class.rs b/src/v1_23/api/networking/v1/ingress_class.rs index d3ab7820c7..c7206cf8f9 100644 --- a/src/v1_23/api/networking/v1/ingress_class.rs +++ b/src/v1_23/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_23/api/networking/v1/mod.rs b/src/v1_23/api/networking/v1/mod.rs index 57e8151751..5949617542 100644 --- a/src/v1_23/api/networking/v1/mod.rs +++ b/src/v1_23/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -43,7 +40,6 @@ pub use self::ingress_tls::IngressTLS; mod network_policy; pub use self::network_policy::NetworkPolicy; -#[cfg(feature = "api")] pub use self::network_policy::ReadNetworkPolicyResponse; mod network_policy_egress_rule; pub use self::network_policy_egress_rule::NetworkPolicyEgressRule; diff --git a/src/v1_23/api/networking/v1/network_policy.rs b/src/v1_23/api/networking/v1/network_policy.rs index e7e2cd8618..daf2122a80 100644 --- a/src/v1_23/api/networking/v1/network_policy.rs +++ b/src/v1_23/api/networking/v1/network_policy.rs @@ -10,458 +10,6 @@ pub struct NetworkPolicy { pub spec: 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 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 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 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"; diff --git a/src/v1_23/api/node/v1/mod.rs b/src/v1_23/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_23/api/node/v1/mod.rs +++ b/src/v1_23/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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_23/api/node/v1/runtime_class.rs b/src/v1_23/api/node/v1/runtime_class.rs index b8b7e6e539..22df0a5837 100644 --- a/src/v1_23/api/node/v1/runtime_class.rs +++ b/src/v1_23/api/node/v1/runtime_class.rs @@ -18,342 +18,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_23/api/node/v1alpha1/mod.rs b/src/v1_23/api/node/v1alpha1/mod.rs index 50b5d5e0b2..d94e5df471 100644 --- a/src/v1_23/api/node/v1alpha1/mod.rs +++ b/src/v1_23/api/node/v1alpha1/mod.rs @@ -4,7 +4,6 @@ pub use self::overhead::Overhead; mod runtime_class; pub use self::runtime_class::RuntimeClass; -#[cfg(feature = "api")] pub use self::runtime_class::ReadRuntimeClassResponse; mod runtime_class_spec; pub use self::runtime_class_spec::RuntimeClassSpec; diff --git a/src/v1_23/api/node/v1alpha1/runtime_class.rs b/src/v1_23/api/node/v1alpha1/runtime_class.rs index 3d28fafe49..087ac57a0f 100644 --- a/src/v1_23/api/node/v1alpha1/runtime_class.rs +++ b/src/v1_23/api/node/v1alpha1/runtime_class.rs @@ -10,342 +10,6 @@ pub struct RuntimeClass { pub spec: crate::api::node::v1alpha1::RuntimeClassSpec, } -// Begin node.k8s.io/v1alpha1/RuntimeClass - -// Generated from operation createNodeV1alpha1RuntimeClass - -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::v1alpha1::RuntimeClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/node.k8s.io/v1alpha1/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 deleteNodeV1alpha1CollectionRuntimeClass - -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/v1alpha1/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 deleteNodeV1alpha1RuntimeClass - -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/v1alpha1/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 listNodeV1alpha1RuntimeClass - -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/v1alpha1/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 patchNodeV1alpha1RuntimeClass - -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/v1alpha1/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 readNodeV1alpha1RuntimeClass - -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/v1alpha1/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::v1alpha1::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 replaceNodeV1alpha1RuntimeClass - -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::v1alpha1::RuntimeClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/node.k8s.io/v1alpha1/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 watchNodeV1alpha1RuntimeClass - -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/v1alpha1/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/v1alpha1/RuntimeClass - impl crate::Resource for RuntimeClass { const API_VERSION: &'static str = "node.k8s.io/v1alpha1"; const GROUP: &'static str = "node.k8s.io"; diff --git a/src/v1_23/api/node/v1beta1/mod.rs b/src/v1_23/api/node/v1beta1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_23/api/node/v1beta1/mod.rs +++ b/src/v1_23/api/node/v1beta1/mod.rs @@ -4,7 +4,6 @@ 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_23/api/node/v1beta1/runtime_class.rs b/src/v1_23/api/node/v1beta1/runtime_class.rs index 9963c70a08..0dc55fa234 100644 --- a/src/v1_23/api/node/v1beta1/runtime_class.rs +++ b/src/v1_23/api/node/v1beta1/runtime_class.rs @@ -16,342 +16,6 @@ pub struct RuntimeClass { pub scheduling: Option, } -// Begin node.k8s.io/v1beta1/RuntimeClass - -// Generated from operation createNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/node.k8s.io/v1beta1/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 deleteNodeV1beta1CollectionRuntimeClass - -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/v1beta1/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 deleteNodeV1beta1RuntimeClass - -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/v1beta1/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 listNodeV1beta1RuntimeClass - -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/v1beta1/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 patchNodeV1beta1RuntimeClass - -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/v1beta1/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 readNodeV1beta1RuntimeClass - -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/v1beta1/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::v1beta1::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 replaceNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/node.k8s.io/v1beta1/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 watchNodeV1beta1RuntimeClass - -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/v1beta1/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/v1beta1/RuntimeClass - impl crate::Resource for RuntimeClass { const API_VERSION: &'static str = "node.k8s.io/v1beta1"; const GROUP: &'static str = "node.k8s.io"; diff --git a/src/v1_23/api/policy/v1/eviction.rs b/src/v1_23/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_23/api/policy/v1/eviction.rs +++ b/src/v1_23/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_23/api/policy/v1/mod.rs b/src/v1_23/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_23/api/policy/v1/mod.rs +++ b/src/v1_23/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; 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 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_23/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_23/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_23/api/policy/v1beta1/mod.rs b/src/v1_23/api/policy/v1beta1/mod.rs index bb4bd412bd..d04299f0b4 100644 --- a/src/v1_23/api/policy/v1beta1/mod.rs +++ b/src/v1_23/api/policy/v1beta1/mod.rs @@ -19,8 +19,6 @@ pub use self::id_range::IDRange; 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; @@ -30,7 +28,6 @@ pub use self::pod_disruption_budget_status::PodDisruptionBudgetStatus; mod pod_security_policy; pub use self::pod_security_policy::PodSecurityPolicy; -#[cfg(feature = "api")] pub use self::pod_security_policy::ReadPodSecurityPolicyResponse; mod pod_security_policy_spec; pub use self::pod_security_policy_spec::PodSecurityPolicySpec; 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 cee96e2f07..610263c049 100644 --- a/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_23/api/policy/v1beta1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct PodDisruptionBudget { pub status: Option, } -// Begin policy/v1beta1/PodDisruptionBudget - -// Generated from operation createPolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 deletePolicyV1beta1CollectionNamespacedPodDisruptionBudget - -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/v1beta1/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 deletePolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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 readPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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::v1beta1::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 readPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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::v1beta1::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 replacePolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 replacePolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 watchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 watchPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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/v1beta1/PodDisruptionBudget - impl crate::Resource for PodDisruptionBudget { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; 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 1a515209d1..66b89ae510 100644 --- a/src/v1_23/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_23/api/policy/v1beta1/pod_security_policy.rs @@ -10,342 +10,6 @@ pub struct PodSecurityPolicy { pub spec: Option, } -// Begin policy/v1beta1/PodSecurityPolicy - -// Generated from operation createPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// create a PodSecurityPolicy - /// - /// 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::policy::v1beta1::PodSecurityPolicy, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1CollectionPodSecurityPolicy - -impl PodSecurityPolicy { - /// delete collection of PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// delete a PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 listPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 patchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// partially update the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 readPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// read the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSecurityPolicyResponse`]`>` constructor, or [`ReadPodSecurityPolicyResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - #[cfg(feature = "api")] - pub fn read( - name: &str, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 [`PodSecurityPolicy::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSecurityPolicyResponse { - Ok(crate::api::policy::v1beta1::PodSecurityPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSecurityPolicyResponse { - 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((ReadPodSecurityPolicyResponse::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((ReadPodSecurityPolicyResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replacePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// replace the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::policy::v1beta1::PodSecurityPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 watchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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/v1beta1/PodSecurityPolicy - impl crate::Resource for PodSecurityPolicy { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; diff --git a/src/v1_23/api/rbac/v1/cluster_role.rs b/src/v1_23/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_23/api/rbac/v1/cluster_role.rs +++ b/src/v1_23/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; 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 04fa2bd714..f35ae335c2 100644 --- a/src/v1_23/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_23/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_23/api/rbac/v1/mod.rs b/src/v1_23/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_23/api/rbac/v1/mod.rs +++ b/src/v1_23/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_23/api/rbac/v1/role.rs b/src/v1_23/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_23/api/rbac/v1/role.rs +++ b/src/v1_23/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_23/api/rbac/v1/role_binding.rs b/src/v1_23/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_23/api/rbac/v1/role_binding.rs +++ b/src/v1_23/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_23/api/scheduling/v1/mod.rs b/src/v1_23/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_23/api/scheduling/v1/mod.rs +++ b/src/v1_23/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_23/api/scheduling/v1/priority_class.rs b/src/v1_23/api/scheduling/v1/priority_class.rs index a7dba60fbd..62a111951c 100644 --- a/src/v1_23/api/scheduling/v1/priority_class.rs +++ b/src/v1_23/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_23/api/storage/v1/csi_driver.rs b/src/v1_23/api/storage/v1/csi_driver.rs index 0dc419fa28..b9bf9360f9 100644 --- a/src/v1_23/api/storage/v1/csi_driver.rs +++ b/src/v1_23/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_23/api/storage/v1/csi_node.rs b/src/v1_23/api/storage/v1/csi_node.rs index a514ce9bf0..92674e4267 100644 --- a/src/v1_23/api/storage/v1/csi_node.rs +++ b/src/v1_23/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; diff --git a/src/v1_23/api/storage/v1/mod.rs b/src/v1_23/api/storage/v1/mod.rs index 70c75595b0..d6c4e85b69 100644 --- a/src/v1_23/api/storage/v1/mod.rs +++ b/src/v1_23/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,15 +16,12 @@ pub use self::csi_node_spec::CSINodeSpec; 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; diff --git a/src/v1_23/api/storage/v1/storage_class.rs b/src/v1_23/api/storage/v1/storage_class.rs index 12774ba320..1b39f75ad7 100644 --- a/src/v1_23/api/storage/v1/storage_class.rs +++ b/src/v1_23/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_23/api/storage/v1/volume_attachment.rs b/src/v1_23/api/storage/v1/volume_attachment.rs index f6b6972639..624ab4dbe0 100644 --- a/src/v1_23/api/storage/v1/volume_attachment.rs +++ b/src/v1_23/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; 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 5d4e7656c1..b23ef6ffae 100644 --- a/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs +++ b/src/v1_23/api/storage/v1alpha1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { pub storage_class_name: String, } -// Begin storage.k8s.io/v1alpha1/CSIStorageCapacity - -// Generated from operation createStorageV1alpha1NamespacedCSIStorageCapacity - -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::v1alpha1::CSIStorageCapacity, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/storage.k8s.io/v1alpha1/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 deleteStorageV1alpha1CollectionNamespacedCSIStorageCapacity - -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/v1alpha1/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 deleteStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 listStorageV1alpha1CSIStorageCapacityForAllNamespaces - -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/v1alpha1/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 listStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 patchStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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 readStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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::v1alpha1::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 replaceStorageV1alpha1NamespacedCSIStorageCapacity - -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::v1alpha1::CSIStorageCapacity, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/storage.k8s.io/v1alpha1/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 watchStorageV1alpha1CSIStorageCapacityForAllNamespaces - -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/v1alpha1/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 watchStorageV1alpha1NamespacedCSIStorageCapacity - -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/v1alpha1/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/v1alpha1/CSIStorageCapacity - impl crate::Resource for CSIStorageCapacity { const API_VERSION: &'static str = "storage.k8s.io/v1alpha1"; const GROUP: &'static str = "storage.k8s.io"; diff --git a/src/v1_23/api/storage/v1alpha1/mod.rs b/src/v1_23/api/storage/v1alpha1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_23/api/storage/v1alpha1/mod.rs +++ b/src/v1_23/api/storage/v1alpha1/mod.rs @@ -1,4 +1,3 @@ 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_23/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs index f3b5e51d4d..1e2b135a25 100644 --- a/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_23/api/storage/v1beta1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_23/api/storage/v1beta1/mod.rs b/src/v1_23/api/storage/v1beta1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_23/api/storage/v1beta1/mod.rs +++ b/src/v1_23/api/storage/v1beta1/mod.rs @@ -1,4 +1,3 @@ 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_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 c05e8ea174..be33903b77 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 @@ -13,495 +13,6 @@ pub struct 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"; diff --git a/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs index 658cc6488f..25a7b1e212 100644 --- a/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_23/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_23/create_optional.rs b/src/v1_23/create_optional.rs deleted file mode 100644 index 7022d778d9..0000000000 --- a/src/v1_23/create_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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 determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields. - 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_23/create_response.rs b/src/v1_23/create_response.rs deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_23/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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_23/delete_optional.rs b/src/v1_23/delete_optional.rs deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_23/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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_23/delete_response.rs b/src/v1_23/delete_response.rs deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_23/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 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 @@ -13,495 +13,6 @@ pub struct APIService { 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"; diff --git a/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs index e48afb5807..57d836af46 100644 --- a/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_23/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_23/list_optional.rs b/src/v1_23/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_23/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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_23/list_response.rs b/src/v1_23/list_response.rs deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_23/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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_23/mod.rs b/src/v1_23/mod.rs index b92ed966b2..27088faf3b 100644 --- a/src/v1_23/mod.rs +++ b/src/v1_23/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,3370 +9,3 @@ 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 getAutoscalingV2beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV2beta1APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV2beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_autoscaling_v2beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/autoscaling/v2beta1/".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_v2beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAutoscalingV2beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAutoscalingV2beta1APIResourcesResponse { - 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((GetAutoscalingV2beta1APIResourcesResponse::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((GetAutoscalingV2beta1APIResourcesResponse::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 getBatchV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetBatchV1beta1APIResourcesResponse`]`>` constructor, or [`GetBatchV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_batch_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/batch/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_batch_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetBatchV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetBatchV1beta1APIResourcesResponse { - 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((GetBatchV1beta1APIResourcesResponse::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((GetBatchV1beta1APIResourcesResponse::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 getDiscoveryV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetDiscoveryV1beta1APIResourcesResponse`]`>` constructor, or [`GetDiscoveryV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_discovery_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/discovery.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_discovery_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetDiscoveryV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetDiscoveryV1beta1APIResourcesResponse { - 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((GetDiscoveryV1beta1APIResourcesResponse::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((GetDiscoveryV1beta1APIResourcesResponse::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 getEventsV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetEventsV1beta1APIResourcesResponse`]`>` constructor, or [`GetEventsV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_events_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/events.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_events_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetEventsV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetEventsV1beta1APIResourcesResponse { - 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((GetEventsV1beta1APIResourcesResponse::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((GetEventsV1beta1APIResourcesResponse::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 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 getNodeV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1alpha1APIResourcesResponse`]`>` constructor, or [`GetNodeV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_node_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/node.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_node_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetNodeV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetNodeV1alpha1APIResourcesResponse { - 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((GetNodeV1alpha1APIResourcesResponse::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((GetNodeV1alpha1APIResourcesResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation getNodeV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1beta1APIResourcesResponse`]`>` constructor, or [`GetNodeV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_node_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/node.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_node_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetNodeV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetNodeV1beta1APIResourcesResponse { - 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((GetNodeV1beta1APIResourcesResponse::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((GetNodeV1beta1APIResourcesResponse::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 getPolicyV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetPolicyV1beta1APIResourcesResponse`]`>` constructor, or [`GetPolicyV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_policy_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/policy/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_policy_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetPolicyV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetPolicyV1beta1APIResourcesResponse { - 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((GetPolicyV1beta1APIResourcesResponse::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((GetPolicyV1beta1APIResourcesResponse::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 getStorageV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetStorageV1alpha1APIResourcesResponse`]`>` constructor, or [`GetStorageV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_storage_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/storage.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_storage_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetStorageV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetStorageV1alpha1APIResourcesResponse { - 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((GetStorageV1alpha1APIResourcesResponse::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((GetStorageV1alpha1APIResourcesResponse::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_23/patch_optional.rs b/src/v1_23/patch_optional.rs deleted file mode 100644 index 82c95d00ac..0000000000 --- a/src/v1_23/patch_optional.rs +++ /dev/null @@ -1,43 +0,0 @@ -// 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 determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields. - 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_23/patch_response.rs b/src/v1_23/patch_response.rs deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_23/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_23/replace_optional.rs b/src/v1_23/replace_optional.rs deleted file mode 100644 index e0e0f32914..0000000000 --- a/src/v1_23/replace_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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 determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields. - 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_23/replace_response.rs b/src/v1_23/replace_response.rs deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_23/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_23/watch_optional.rs b/src/v1_23/watch_optional.rs deleted file mode 100644 index cf0ebe7300..0000000000 --- a/src/v1_23/watch_optional.rs +++ /dev/null @@ -1,60 +0,0 @@ -// 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>, - - /// 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> 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", 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_23/watch_response.rs b/src/v1_23/watch_response.rs deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_23/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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/src/v1_24/api/admissionregistration/v1/mod.rs b/src/v1_24/api/admissionregistration/v1/mod.rs index ace31fe7fb..4b1bbcbd9c 100644 --- a/src/v1_24/api/admissionregistration/v1/mod.rs +++ b/src/v1_24/api/admissionregistration/v1/mod.rs @@ -4,7 +4,6 @@ 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; @@ -17,7 +16,6 @@ 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_24/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_24/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; 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 ff20990424..f188208c4d 100644 --- a/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_24/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_24/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_24/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_24/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_24/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs index c5d811a2fd..447818b5bf 100644 --- a/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_24/api/apiserverinternal/v1alpha1/storage_version.rs @@ -13,495 +13,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_24/api/apps/v1/controller_revision.rs b/src/v1_24/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_24/api/apps/v1/controller_revision.rs +++ b/src/v1_24/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_24/api/apps/v1/daemon_set.rs b/src/v1_24/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_24/api/apps/v1/daemon_set.rs +++ b/src/v1_24/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_24/api/apps/v1/deployment.rs b/src/v1_24/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_24/api/apps/v1/deployment.rs +++ b/src/v1_24/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_24/api/apps/v1/mod.rs b/src/v1_24/api/apps/v1/mod.rs index 9b0d98c82d..8ccdb8295f 100644 --- a/src/v1_24/api/apps/v1/mod.rs +++ b/src/v1_24/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_24/api/apps/v1/replica_set.rs b/src/v1_24/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_24/api/apps/v1/replica_set.rs +++ b/src/v1_24/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_24/api/apps/v1/stateful_set.rs b/src/v1_24/api/apps/v1/stateful_set.rs index 513df14954..d7a358f132 100644 --- a/src/v1_24/api/apps/v1/stateful_set.rs +++ b/src/v1_24/api/apps/v1/stateful_set.rs @@ -17,629 +17,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_24/api/authentication/v1/token_request.rs b/src/v1_24/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_24/api/authentication/v1/token_request.rs +++ b/src/v1_24/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_24/api/authentication/v1/token_review.rs b/src/v1_24/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_24/api/authentication/v1/token_review.rs +++ b/src/v1_24/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; diff --git a/src/v1_24/api/authorization/v1/local_subject_access_review.rs b/src/v1_24/api/authorization/v1/local_subject_access_review.rs index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_24/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_24/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; diff --git a/src/v1_24/api/authorization/v1/self_subject_access_review.rs b/src/v1_24/api/authorization/v1/self_subject_access_review.rs index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_24/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_24/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; diff --git a/src/v1_24/api/authorization/v1/self_subject_rules_review.rs b/src/v1_24/api/authorization/v1/self_subject_rules_review.rs index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_24/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_24/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_24/api/authorization/v1/subject_access_review.rs b/src/v1_24/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_24/api/authorization/v1/subject_access_review.rs +++ b/src/v1_24/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; 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 01ee0ebcfc..79156137f7 100644 --- a/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_24/api/autoscaling/v1/mod.rs b/src/v1_24/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_24/api/autoscaling/v1/mod.rs +++ b/src/v1_24/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_24/api/autoscaling/v1/scale.rs b/src/v1_24/api/autoscaling/v1/scale.rs index 89a7024529..8e96f95929 100644 --- a/src/v1_24/api/autoscaling/v1/scale.rs +++ b/src/v1_24/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; 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 e3df4c800c..e60e51dc10 100644 --- a/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_24/api/autoscaling/v2/mod.rs b/src/v1_24/api/autoscaling/v2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_24/api/autoscaling/v2/mod.rs +++ b/src/v1_24/api/autoscaling/v2/mod.rs @@ -22,8 +22,6 @@ 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; 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 50b9970024..8ba3951299 100644 --- a/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2beta1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { pub status: Option, } -// Begin autoscaling/v2beta1/HorizontalPodAutoscaler - -// Generated from operation createAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 deleteAutoscalingV2beta1CollectionNamespacedHorizontalPodAutoscaler - -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/v2beta1/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 deleteAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 listAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 listAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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 patchAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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::v2beta1::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 readAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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/v2beta1/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::v2beta1::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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 replaceAutoscalingV2beta1NamespacedHorizontalPodAutoscalerStatus - -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::v2beta1::HorizontalPodAutoscaler, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/autoscaling/v2beta1/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 watchAutoscalingV2beta1HorizontalPodAutoscalerForAllNamespaces - -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/v2beta1/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 watchAutoscalingV2beta1NamespacedHorizontalPodAutoscaler - -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/v2beta1/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/v2beta1/HorizontalPodAutoscaler - impl crate::Resource for HorizontalPodAutoscaler { const API_VERSION: &'static str = "autoscaling/v2beta1"; const GROUP: &'static str = "autoscaling"; diff --git a/src/v1_24/api/autoscaling/v2beta1/mod.rs b/src/v1_24/api/autoscaling/v2beta1/mod.rs index c4f4c20ae7..49c8f63baf 100644 --- a/src/v1_24/api/autoscaling/v2beta1/mod.rs +++ b/src/v1_24/api/autoscaling/v2beta1/mod.rs @@ -16,8 +16,6 @@ pub use self::external_metric_status::ExternalMetricStatus; 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_condition; pub use self::horizontal_pod_autoscaler_condition::HorizontalPodAutoscalerCondition; 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 df7124afd7..77ee3e9293 100644 --- a/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_24/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_24/api/autoscaling/v2beta2/mod.rs b/src/v1_24/api/autoscaling/v2beta2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_24/api/autoscaling/v2beta2/mod.rs +++ b/src/v1_24/api/autoscaling/v2beta2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_24/api/batch/v1/cron_job.rs b/src/v1_24/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_24/api/batch/v1/cron_job.rs +++ b/src/v1_24/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_24/api/batch/v1/job.rs b/src/v1_24/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_24/api/batch/v1/job.rs +++ b/src/v1_24/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_24/api/batch/v1/mod.rs b/src/v1_24/api/batch/v1/mod.rs index 7ea46051db..2d319f9e18 100644 --- a/src/v1_24/api/batch/v1/mod.rs +++ b/src/v1_24/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_24/api/batch/v1beta1/cron_job.rs b/src/v1_24/api/batch/v1beta1/cron_job.rs index 6d31b80fcb..7b61f80131 100644 --- a/src/v1_24/api/batch/v1beta1/cron_job.rs +++ b/src/v1_24/api/batch/v1beta1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { pub status: Option, } -// Begin batch/v1beta1/CronJob - -// Generated from operation createBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 deleteBatchV1beta1CollectionNamespacedCronJob - -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/v1beta1/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 deleteBatchV1beta1NamespacedCronJob - -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/v1beta1/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 listBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 listBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJob - -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/v1beta1/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 patchBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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 readBatchV1beta1NamespacedCronJob - -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/v1beta1/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::v1beta1::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 readBatchV1beta1NamespacedCronJobStatus - -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/v1beta1/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::v1beta1::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 replaceBatchV1beta1NamespacedCronJob - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 replaceBatchV1beta1NamespacedCronJobStatus - -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::v1beta1::CronJob, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/batch/v1beta1/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 watchBatchV1beta1CronJobForAllNamespaces - -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/v1beta1/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 watchBatchV1beta1NamespacedCronJob - -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/v1beta1/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/v1beta1/CronJob - impl crate::Resource for CronJob { const API_VERSION: &'static str = "batch/v1beta1"; const GROUP: &'static str = "batch"; diff --git a/src/v1_24/api/batch/v1beta1/mod.rs b/src/v1_24/api/batch/v1beta1/mod.rs index 3c1c8c9452..554766ce17 100644 --- a/src/v1_24/api/batch/v1beta1/mod.rs +++ b/src/v1_24/api/batch/v1beta1/mod.rs @@ -1,8 +1,6 @@ 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; 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 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_24/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_24/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_24/api/certificates/v1/mod.rs b/src/v1_24/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_24/api/certificates/v1/mod.rs +++ b/src/v1_24/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_24/api/coordination/v1/lease.rs b/src/v1_24/api/coordination/v1/lease.rs index 3e32685cbc..199762cc9a 100644 --- a/src/v1_24/api/coordination/v1/lease.rs +++ b/src/v1_24/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_24/api/coordination/v1/mod.rs b/src/v1_24/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_24/api/coordination/v1/mod.rs +++ b/src/v1_24/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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_24/api/core/v1/binding.rs b/src/v1_24/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_24/api/core/v1/binding.rs +++ b/src/v1_24/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_24/api/core/v1/component_status.rs b/src/v1_24/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_24/api/core/v1/component_status.rs +++ b/src/v1_24/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_24/api/core/v1/config_map.rs b/src/v1_24/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_24/api/core/v1/config_map.rs +++ b/src/v1_24/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_24/api/core/v1/endpoints.rs b/src/v1_24/api/core/v1/endpoints.rs index 74d95ffd83..3cb5e56421 100644 --- a/src/v1_24/api/core/v1/endpoints.rs +++ b/src/v1_24/api/core/v1/endpoints.rs @@ -22,458 +22,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_24/api/core/v1/event.rs b/src/v1_24/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_24/api/core/v1/event.rs +++ b/src/v1_24/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_24/api/core/v1/limit_range.rs b/src/v1_24/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_24/api/core/v1/limit_range.rs +++ b/src/v1_24/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_24/api/core/v1/mod.rs b/src/v1_24/api/core/v1/mod.rs index f8cee71f8e..cc8980d154 100644 --- a/src/v1_24/api/core/v1/mod.rs +++ b/src/v1_24/api/core/v1/mod.rs @@ -49,11 +49,9 @@ 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; @@ -120,7 +118,6 @@ 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; @@ -139,7 +136,6 @@ 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; @@ -206,7 +202,6 @@ 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; @@ -231,8 +226,6 @@ 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; @@ -245,18 +238,6 @@ 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; @@ -302,13 +283,9 @@ 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; @@ -336,26 +313,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -395,7 +352,6 @@ 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; @@ -426,8 +382,6 @@ 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; @@ -443,8 +397,6 @@ 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; @@ -475,7 +427,6 @@ 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; @@ -497,22 +448,9 @@ 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; diff --git a/src/v1_24/api/core/v1/namespace.rs b/src/v1_24/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_24/api/core/v1/namespace.rs +++ b/src/v1_24/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_24/api/core/v1/node.rs b/src/v1_24/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_24/api/core/v1/node.rs +++ b/src/v1_24/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_24/api/core/v1/persistent_volume.rs b/src/v1_24/api/core/v1/persistent_volume.rs index c3d9dde5a2..7cb7fa7a7e 100644 --- a/src/v1_24/api/core/v1/persistent_volume.rs +++ b/src/v1_24/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; 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 e882129db9..f6ab75b14b 100644 --- a/src/v1_24/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_24/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_24/api/core/v1/pod.rs b/src/v1_24/api/core/v1/pod.rs index f99a63faa1..803af6a12a 100644 --- a/src/v1_24/api/core/v1/pod.rs +++ b/src/v1_24/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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 = ""; diff --git a/src/v1_24/api/core/v1/pod_template.rs b/src/v1_24/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_24/api/core/v1/pod_template.rs +++ b/src/v1_24/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_24/api/core/v1/replication_controller.rs b/src/v1_24/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_24/api/core/v1/replication_controller.rs +++ b/src/v1_24/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_24/api/core/v1/resource_quota.rs b/src/v1_24/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_24/api/core/v1/resource_quota.rs +++ b/src/v1_24/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_24/api/core/v1/secret.rs b/src/v1_24/api/core/v1/secret.rs index eb75155e0d..4c93df7798 100644 --- a/src/v1_24/api/core/v1/secret.rs +++ b/src/v1_24/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_24/api/core/v1/service.rs b/src/v1_24/api/core/v1/service.rs index d5b201c7a6..4add73225c 100644 --- a/src/v1_24/api/core/v1/service.rs +++ b/src/v1_24/api/core/v1/service.rs @@ -13,1169 +13,6 @@ pub struct Service { 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 = ""; diff --git a/src/v1_24/api/core/v1/service_account.rs b/src/v1_24/api/core/v1/service_account.rs index 1f966964fe..f9cc91ab51 100644 --- a/src/v1_24/api/core/v1/service_account.rs +++ b/src/v1_24/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_24/api/discovery/v1/endpoint_slice.rs b/src/v1_24/api/discovery/v1/endpoint_slice.rs index 033c1c4e60..ee595d764c 100644 --- a/src/v1_24/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_24/api/discovery/v1/endpoint_slice.rs @@ -17,458 +17,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_24/api/discovery/v1/mod.rs b/src/v1_24/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_24/api/discovery/v1/mod.rs +++ b/src/v1_24/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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_24/api/discovery/v1beta1/endpoint_slice.rs b/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs index 12d89081fa..798998e5b7 100644 --- a/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs +++ b/src/v1_24/api/discovery/v1beta1/endpoint_slice.rs @@ -16,458 +16,6 @@ pub struct EndpointSlice { pub ports: Option>, } -// Begin discovery.k8s.io/v1beta1/EndpointSlice - -// Generated from operation createDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 deleteDiscoveryV1beta1CollectionNamespacedEndpointSlice - -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/v1beta1/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 deleteDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 listDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 listDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 patchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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 readDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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::v1beta1::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 replaceDiscoveryV1beta1NamespacedEndpointSlice - -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::v1beta1::EndpointSlice, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/discovery.k8s.io/v1beta1/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 watchDiscoveryV1beta1EndpointSliceForAllNamespaces - -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/v1beta1/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 watchDiscoveryV1beta1NamespacedEndpointSlice - -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/v1beta1/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/v1beta1/EndpointSlice - impl crate::Resource for EndpointSlice { const API_VERSION: &'static str = "discovery.k8s.io/v1beta1"; const GROUP: &'static str = "discovery.k8s.io"; diff --git a/src/v1_24/api/discovery/v1beta1/mod.rs b/src/v1_24/api/discovery/v1beta1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_24/api/discovery/v1beta1/mod.rs +++ b/src/v1_24/api/discovery/v1beta1/mod.rs @@ -13,7 +13,6 @@ 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_24/api/events/v1/event.rs b/src/v1_24/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_24/api/events/v1/event.rs +++ b/src/v1_24/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_24/api/events/v1/mod.rs b/src/v1_24/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_24/api/events/v1/mod.rs +++ b/src/v1_24/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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_24/api/events/v1beta1/event.rs b/src/v1_24/api/events/v1beta1/event.rs index c2030320f7..135edd4176 100644 --- a/src/v1_24/api/events/v1beta1/event.rs +++ b/src/v1_24/api/events/v1beta1/event.rs @@ -49,458 +49,6 @@ pub struct Event { pub type_: Option, } -// Begin events.k8s.io/v1beta1/Event - -// Generated from operation createEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 deleteEventsV1beta1CollectionNamespacedEvent - -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/v1beta1/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 deleteEventsV1beta1NamespacedEvent - -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/v1beta1/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 listEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 listEventsV1beta1NamespacedEvent - -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/v1beta1/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 patchEventsV1beta1NamespacedEvent - -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/v1beta1/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 readEventsV1beta1NamespacedEvent - -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/v1beta1/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::v1beta1::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 replaceEventsV1beta1NamespacedEvent - -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::v1beta1::Event, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/events.k8s.io/v1beta1/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 watchEventsV1beta1EventForAllNamespaces - -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/v1beta1/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 watchEventsV1beta1NamespacedEvent - -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/v1beta1/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/v1beta1/Event - impl crate::Resource for Event { const API_VERSION: &'static str = "events.k8s.io/v1beta1"; const GROUP: &'static str = "events.k8s.io"; diff --git a/src/v1_24/api/events/v1beta1/mod.rs b/src/v1_24/api/events/v1beta1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_24/api/events/v1beta1/mod.rs +++ b/src/v1_24/api/events/v1beta1/mod.rs @@ -1,7 +1,6 @@ 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_24/api/flowcontrol/v1beta1/flow_schema.rs b/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs index 1d0546a710..bc2d5f91b1 100644 --- a/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_24/api/flowcontrol/v1beta1/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_24/api/flowcontrol/v1beta1/mod.rs b/src/v1_24/api/flowcontrol/v1beta1/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_24/api/flowcontrol/v1beta1/mod.rs +++ b/src/v1_24/api/flowcontrol/v1beta1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; 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 4cbe999e32..8546c26d30 100644 --- a/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_24/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs index 71d13230a3..bb9f5a3a92 100644 --- a/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_24/api/flowcontrol/v1beta2/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_24/api/flowcontrol/v1beta2/mod.rs b/src/v1_24/api/flowcontrol/v1beta2/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_24/api/flowcontrol/v1beta2/mod.rs +++ b/src/v1_24/api/flowcontrol/v1beta2/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; 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 91ebc9f1f5..2f8bb6a7cc 100644 --- a/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_24/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_24/api/networking/v1/ingress.rs b/src/v1_24/api/networking/v1/ingress.rs index c9e616121f..d97b30d97c 100644 --- a/src/v1_24/api/networking/v1/ingress.rs +++ b/src/v1_24/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_24/api/networking/v1/ingress_class.rs b/src/v1_24/api/networking/v1/ingress_class.rs index d3ab7820c7..c7206cf8f9 100644 --- a/src/v1_24/api/networking/v1/ingress_class.rs +++ b/src/v1_24/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_24/api/networking/v1/mod.rs b/src/v1_24/api/networking/v1/mod.rs index c8622860c4..e4792b2d2d 100644 --- a/src/v1_24/api/networking/v1/mod.rs +++ b/src/v1_24/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -43,8 +40,6 @@ 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; diff --git a/src/v1_24/api/networking/v1/network_policy.rs b/src/v1_24/api/networking/v1/network_policy.rs index 36ed661520..1370f27b72 100644 --- a/src/v1_24/api/networking/v1/network_policy.rs +++ b/src/v1_24/api/networking/v1/network_policy.rs @@ -13,629 +13,6 @@ pub struct NetworkPolicy { 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"; diff --git a/src/v1_24/api/node/v1/mod.rs b/src/v1_24/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_24/api/node/v1/mod.rs +++ b/src/v1_24/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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_24/api/node/v1/runtime_class.rs b/src/v1_24/api/node/v1/runtime_class.rs index 470b9f902d..df33206097 100644 --- a/src/v1_24/api/node/v1/runtime_class.rs +++ b/src/v1_24/api/node/v1/runtime_class.rs @@ -17,342 +17,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_24/api/node/v1beta1/mod.rs b/src/v1_24/api/node/v1beta1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_24/api/node/v1beta1/mod.rs +++ b/src/v1_24/api/node/v1beta1/mod.rs @@ -4,7 +4,6 @@ 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_24/api/node/v1beta1/runtime_class.rs b/src/v1_24/api/node/v1beta1/runtime_class.rs index 31fffa9653..225def8753 100644 --- a/src/v1_24/api/node/v1beta1/runtime_class.rs +++ b/src/v1_24/api/node/v1beta1/runtime_class.rs @@ -16,342 +16,6 @@ pub struct RuntimeClass { pub scheduling: Option, } -// Begin node.k8s.io/v1beta1/RuntimeClass - -// Generated from operation createNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/node.k8s.io/v1beta1/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 deleteNodeV1beta1CollectionRuntimeClass - -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/v1beta1/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 deleteNodeV1beta1RuntimeClass - -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/v1beta1/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 listNodeV1beta1RuntimeClass - -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/v1beta1/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 patchNodeV1beta1RuntimeClass - -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/v1beta1/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 readNodeV1beta1RuntimeClass - -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/v1beta1/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::v1beta1::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 replaceNodeV1beta1RuntimeClass - -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::v1beta1::RuntimeClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/node.k8s.io/v1beta1/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 watchNodeV1beta1RuntimeClass - -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/v1beta1/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/v1beta1/RuntimeClass - impl crate::Resource for RuntimeClass { const API_VERSION: &'static str = "node.k8s.io/v1beta1"; const GROUP: &'static str = "node.k8s.io"; diff --git a/src/v1_24/api/policy/v1/eviction.rs b/src/v1_24/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_24/api/policy/v1/eviction.rs +++ b/src/v1_24/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_24/api/policy/v1/mod.rs b/src/v1_24/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_24/api/policy/v1/mod.rs +++ b/src/v1_24/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; 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 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_24/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_24/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_24/api/policy/v1beta1/mod.rs b/src/v1_24/api/policy/v1beta1/mod.rs index bb4bd412bd..d04299f0b4 100644 --- a/src/v1_24/api/policy/v1beta1/mod.rs +++ b/src/v1_24/api/policy/v1beta1/mod.rs @@ -19,8 +19,6 @@ pub use self::id_range::IDRange; 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; @@ -30,7 +28,6 @@ pub use self::pod_disruption_budget_status::PodDisruptionBudgetStatus; mod pod_security_policy; pub use self::pod_security_policy::PodSecurityPolicy; -#[cfg(feature = "api")] pub use self::pod_security_policy::ReadPodSecurityPolicyResponse; mod pod_security_policy_spec; pub use self::pod_security_policy_spec::PodSecurityPolicySpec; 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 cee96e2f07..610263c049 100644 --- a/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs +++ b/src/v1_24/api/policy/v1beta1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct PodDisruptionBudget { pub status: Option, } -// Begin policy/v1beta1/PodDisruptionBudget - -// Generated from operation createPolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 deletePolicyV1beta1CollectionNamespacedPodDisruptionBudget - -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/v1beta1/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 deletePolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 listPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 patchPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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 readPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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::v1beta1::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 readPolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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/v1beta1/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::v1beta1::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 replacePolicyV1beta1NamespacedPodDisruptionBudget - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 replacePolicyV1beta1NamespacedPodDisruptionBudgetStatus - -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::v1beta1::PodDisruptionBudget, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/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 watchPolicyV1beta1NamespacedPodDisruptionBudget - -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/v1beta1/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 watchPolicyV1beta1PodDisruptionBudgetForAllNamespaces - -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/v1beta1/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/v1beta1/PodDisruptionBudget - impl crate::Resource for PodDisruptionBudget { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; 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 1a515209d1..66b89ae510 100644 --- a/src/v1_24/api/policy/v1beta1/pod_security_policy.rs +++ b/src/v1_24/api/policy/v1beta1/pod_security_policy.rs @@ -10,342 +10,6 @@ pub struct PodSecurityPolicy { pub spec: Option, } -// Begin policy/v1beta1/PodSecurityPolicy - -// Generated from operation createPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// create a PodSecurityPolicy - /// - /// 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::policy::v1beta1::PodSecurityPolicy, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1CollectionPodSecurityPolicy - -impl PodSecurityPolicy { - /// delete collection of PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 deletePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// delete a PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 listPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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 patchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// partially update the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `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/policy/v1beta1/podsecuritypolicies/{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 readPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// read the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSecurityPolicyResponse`]`>` constructor, or [`ReadPodSecurityPolicyResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - #[cfg(feature = "api")] - pub fn read( - name: &str, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 [`PodSecurityPolicy::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSecurityPolicyResponse { - Ok(crate::api::policy::v1beta1::PodSecurityPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSecurityPolicyResponse { - 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((ReadPodSecurityPolicyResponse::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((ReadPodSecurityPolicyResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replacePolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// replace the specified PodSecurityPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSecurityPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::policy::v1beta1::PodSecurityPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/policy/v1beta1/podsecuritypolicies/{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 watchPolicyV1beta1PodSecurityPolicy - -impl PodSecurityPolicy { - /// list or watch objects of kind PodSecurityPolicy - /// - /// 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/policy/v1beta1/podsecuritypolicies?".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/v1beta1/PodSecurityPolicy - impl crate::Resource for PodSecurityPolicy { const API_VERSION: &'static str = "policy/v1beta1"; const GROUP: &'static str = "policy"; diff --git a/src/v1_24/api/rbac/v1/cluster_role.rs b/src/v1_24/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_24/api/rbac/v1/cluster_role.rs +++ b/src/v1_24/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; 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 04fa2bd714..f35ae335c2 100644 --- a/src/v1_24/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_24/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_24/api/rbac/v1/mod.rs b/src/v1_24/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_24/api/rbac/v1/mod.rs +++ b/src/v1_24/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_24/api/rbac/v1/role.rs b/src/v1_24/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_24/api/rbac/v1/role.rs +++ b/src/v1_24/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_24/api/rbac/v1/role_binding.rs b/src/v1_24/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_24/api/rbac/v1/role_binding.rs +++ b/src/v1_24/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_24/api/scheduling/v1/mod.rs b/src/v1_24/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_24/api/scheduling/v1/mod.rs +++ b/src/v1_24/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_24/api/scheduling/v1/priority_class.rs b/src/v1_24/api/scheduling/v1/priority_class.rs index f13f535704..d6307206d0 100644 --- a/src/v1_24/api/scheduling/v1/priority_class.rs +++ b/src/v1_24/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_24/api/storage/v1/csi_driver.rs b/src/v1_24/api/storage/v1/csi_driver.rs index 0dc419fa28..b9bf9360f9 100644 --- a/src/v1_24/api/storage/v1/csi_driver.rs +++ b/src/v1_24/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_24/api/storage/v1/csi_node.rs b/src/v1_24/api/storage/v1/csi_node.rs index a514ce9bf0..92674e4267 100644 --- a/src/v1_24/api/storage/v1/csi_node.rs +++ b/src/v1_24/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; 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 02efa5277e..024f4e5150 100644 --- a/src/v1_24/api/storage/v1/csi_storage_capacity.rs +++ b/src/v1_24/api/storage/v1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_24/api/storage/v1/mod.rs b/src/v1_24/api/storage/v1/mod.rs index 673d1d25b1..f0961497d2 100644 --- a/src/v1_24/api/storage/v1/mod.rs +++ b/src/v1_24/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,19 +16,15 @@ 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; diff --git a/src/v1_24/api/storage/v1/storage_class.rs b/src/v1_24/api/storage/v1/storage_class.rs index 12774ba320..1b39f75ad7 100644 --- a/src/v1_24/api/storage/v1/storage_class.rs +++ b/src/v1_24/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_24/api/storage/v1/volume_attachment.rs b/src/v1_24/api/storage/v1/volume_attachment.rs index f6b6972639..624ab4dbe0 100644 --- a/src/v1_24/api/storage/v1/volume_attachment.rs +++ b/src/v1_24/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; 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 3fdc471ce4..cd7929263c 100644 --- a/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_24/api/storage/v1beta1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_24/api/storage/v1beta1/mod.rs b/src/v1_24/api/storage/v1beta1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_24/api/storage/v1beta1/mod.rs +++ b/src/v1_24/api/storage/v1beta1/mod.rs @@ -1,4 +1,3 @@ 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_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 c05e8ea174..be33903b77 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 @@ -13,495 +13,6 @@ pub struct 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"; diff --git a/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs index 658cc6488f..25a7b1e212 100644 --- a/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_24/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_24/create_optional.rs b/src/v1_24/create_optional.rs deleted file mode 100644 index 0d7db46031..0000000000 --- a/src/v1_24/create_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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_24/create_response.rs b/src/v1_24/create_response.rs deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_24/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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_24/delete_optional.rs b/src/v1_24/delete_optional.rs deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_24/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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_24/delete_response.rs b/src/v1_24/delete_response.rs deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_24/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 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 @@ -13,495 +13,6 @@ pub struct APIService { 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"; diff --git a/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs index e48afb5807..57d836af46 100644 --- a/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_24/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_24/list_optional.rs b/src/v1_24/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_24/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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_24/list_response.rs b/src/v1_24/list_response.rs deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_24/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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_24/mod.rs b/src/v1_24/mod.rs index cbfacdde01..27088faf3b 100644 --- a/src/v1_24/mod.rs +++ b/src/v1_24/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,3258 +9,3 @@ 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 getAutoscalingV2beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAutoscalingV2beta1APIResourcesResponse`]`>` constructor, or [`GetAutoscalingV2beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_autoscaling_v2beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/autoscaling/v2beta1/".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_v2beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAutoscalingV2beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAutoscalingV2beta1APIResourcesResponse { - 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((GetAutoscalingV2beta1APIResourcesResponse::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((GetAutoscalingV2beta1APIResourcesResponse::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 getBatchV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetBatchV1beta1APIResourcesResponse`]`>` constructor, or [`GetBatchV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_batch_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/batch/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_batch_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetBatchV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetBatchV1beta1APIResourcesResponse { - 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((GetBatchV1beta1APIResourcesResponse::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((GetBatchV1beta1APIResourcesResponse::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 getDiscoveryV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetDiscoveryV1beta1APIResourcesResponse`]`>` constructor, or [`GetDiscoveryV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_discovery_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/discovery.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_discovery_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetDiscoveryV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetDiscoveryV1beta1APIResourcesResponse { - 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((GetDiscoveryV1beta1APIResourcesResponse::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((GetDiscoveryV1beta1APIResourcesResponse::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 getEventsV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetEventsV1beta1APIResourcesResponse`]`>` constructor, or [`GetEventsV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_events_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/events.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_events_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetEventsV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetEventsV1beta1APIResourcesResponse { - 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((GetEventsV1beta1APIResourcesResponse::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((GetEventsV1beta1APIResourcesResponse::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 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 getNodeV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetNodeV1beta1APIResourcesResponse`]`>` constructor, or [`GetNodeV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_node_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/node.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_node_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetNodeV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetNodeV1beta1APIResourcesResponse { - 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((GetNodeV1beta1APIResourcesResponse::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((GetNodeV1beta1APIResourcesResponse::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 getPolicyV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetPolicyV1beta1APIResourcesResponse`]`>` constructor, or [`GetPolicyV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_policy_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/policy/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_policy_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetPolicyV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetPolicyV1beta1APIResourcesResponse { - 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((GetPolicyV1beta1APIResourcesResponse::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((GetPolicyV1beta1APIResourcesResponse::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_24/patch_optional.rs b/src/v1_24/patch_optional.rs deleted file mode 100644 index 803f498f6c..0000000000 --- a/src/v1_24/patch_optional.rs +++ /dev/null @@ -1,43 +0,0 @@ -// 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_24/patch_response.rs b/src/v1_24/patch_response.rs deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_24/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_24/replace_optional.rs b/src/v1_24/replace_optional.rs deleted file mode 100644 index 9a452099a7..0000000000 --- a/src/v1_24/replace_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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_24/replace_response.rs b/src/v1_24/replace_response.rs deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_24/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_24/watch_optional.rs b/src/v1_24/watch_optional.rs deleted file mode 100644 index cf0ebe7300..0000000000 --- a/src/v1_24/watch_optional.rs +++ /dev/null @@ -1,60 +0,0 @@ -// 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>, - - /// 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> 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", 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_24/watch_response.rs b/src/v1_24/watch_response.rs deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_24/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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/src/v1_25/api/admissionregistration/v1/mod.rs b/src/v1_25/api/admissionregistration/v1/mod.rs index ace31fe7fb..4b1bbcbd9c 100644 --- a/src/v1_25/api/admissionregistration/v1/mod.rs +++ b/src/v1_25/api/admissionregistration/v1/mod.rs @@ -4,7 +4,6 @@ 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; @@ -17,7 +16,6 @@ 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_configuration.rs b/src/v1_25/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_25/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_25/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; diff --git a/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs index ff20990424..f188208c4d 100644 --- a/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_25/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_25/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs index c5d811a2fd..447818b5bf 100644 --- a/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_25/api/apiserverinternal/v1alpha1/storage_version.rs @@ -13,495 +13,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_25/api/apps/v1/controller_revision.rs b/src/v1_25/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_25/api/apps/v1/controller_revision.rs +++ b/src/v1_25/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_25/api/apps/v1/daemon_set.rs b/src/v1_25/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_25/api/apps/v1/daemon_set.rs +++ b/src/v1_25/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_25/api/apps/v1/deployment.rs b/src/v1_25/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_25/api/apps/v1/deployment.rs +++ b/src/v1_25/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_25/api/apps/v1/mod.rs b/src/v1_25/api/apps/v1/mod.rs index 9b0d98c82d..8ccdb8295f 100644 --- a/src/v1_25/api/apps/v1/mod.rs +++ b/src/v1_25/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_25/api/apps/v1/replica_set.rs b/src/v1_25/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_25/api/apps/v1/replica_set.rs +++ b/src/v1_25/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_25/api/apps/v1/stateful_set.rs b/src/v1_25/api/apps/v1/stateful_set.rs index 513df14954..d7a358f132 100644 --- a/src/v1_25/api/apps/v1/stateful_set.rs +++ b/src/v1_25/api/apps/v1/stateful_set.rs @@ -17,629 +17,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_25/api/authentication/v1/token_request.rs b/src/v1_25/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_25/api/authentication/v1/token_request.rs +++ b/src/v1_25/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_25/api/authentication/v1/token_review.rs b/src/v1_25/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_25/api/authentication/v1/token_review.rs +++ b/src/v1_25/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; 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 index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_25/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_25/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; 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 index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_25/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_25/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; 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 index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_25/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_25/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_25/api/authorization/v1/subject_access_review.rs b/src/v1_25/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_25/api/authorization/v1/subject_access_review.rs +++ b/src/v1_25/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; diff --git a/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs index 01ee0ebcfc..79156137f7 100644 --- a/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_25/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_25/api/autoscaling/v1/mod.rs b/src/v1_25/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_25/api/autoscaling/v1/mod.rs +++ b/src/v1_25/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_25/api/autoscaling/v1/scale.rs b/src/v1_25/api/autoscaling/v1/scale.rs index 89a7024529..8e96f95929 100644 --- a/src/v1_25/api/autoscaling/v1/scale.rs +++ b/src/v1_25/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; diff --git a/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs index e3df4c800c..e60e51dc10 100644 --- a/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_25/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_25/api/autoscaling/v2/mod.rs b/src/v1_25/api/autoscaling/v2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_25/api/autoscaling/v2/mod.rs +++ b/src/v1_25/api/autoscaling/v2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs index df7124afd7..77ee3e9293 100644 --- a/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs +++ b/src/v1_25/api/autoscaling/v2beta2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_25/api/autoscaling/v2beta2/mod.rs b/src/v1_25/api/autoscaling/v2beta2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_25/api/autoscaling/v2beta2/mod.rs +++ b/src/v1_25/api/autoscaling/v2beta2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_25/api/batch/v1/cron_job.rs b/src/v1_25/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_25/api/batch/v1/cron_job.rs +++ b/src/v1_25/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_25/api/batch/v1/job.rs b/src/v1_25/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_25/api/batch/v1/job.rs +++ b/src/v1_25/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_25/api/batch/v1/mod.rs b/src/v1_25/api/batch/v1/mod.rs index 09570f200d..689160fc0a 100644 --- a/src/v1_25/api/batch/v1/mod.rs +++ b/src/v1_25/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_25/api/certificates/v1/certificate_signing_request.rs b/src/v1_25/api/certificates/v1/certificate_signing_request.rs index 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_25/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_25/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_25/api/certificates/v1/mod.rs b/src/v1_25/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_25/api/certificates/v1/mod.rs +++ b/src/v1_25/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_25/api/coordination/v1/lease.rs b/src/v1_25/api/coordination/v1/lease.rs index 3e32685cbc..199762cc9a 100644 --- a/src/v1_25/api/coordination/v1/lease.rs +++ b/src/v1_25/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_25/api/coordination/v1/mod.rs b/src/v1_25/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_25/api/coordination/v1/mod.rs +++ b/src/v1_25/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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/v1/binding.rs b/src/v1_25/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_25/api/core/v1/binding.rs +++ b/src/v1_25/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_25/api/core/v1/component_status.rs b/src/v1_25/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_25/api/core/v1/component_status.rs +++ b/src/v1_25/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_25/api/core/v1/config_map.rs b/src/v1_25/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_25/api/core/v1/config_map.rs +++ b/src/v1_25/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_25/api/core/v1/endpoints.rs b/src/v1_25/api/core/v1/endpoints.rs index 74d95ffd83..3cb5e56421 100644 --- a/src/v1_25/api/core/v1/endpoints.rs +++ b/src/v1_25/api/core/v1/endpoints.rs @@ -22,458 +22,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_25/api/core/v1/event.rs b/src/v1_25/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_25/api/core/v1/event.rs +++ b/src/v1_25/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_25/api/core/v1/limit_range.rs b/src/v1_25/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_25/api/core/v1/limit_range.rs +++ b/src/v1_25/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_25/api/core/v1/mod.rs b/src/v1_25/api/core/v1/mod.rs index f8cee71f8e..cc8980d154 100644 --- a/src/v1_25/api/core/v1/mod.rs +++ b/src/v1_25/api/core/v1/mod.rs @@ -49,11 +49,9 @@ 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; @@ -120,7 +118,6 @@ 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; @@ -139,7 +136,6 @@ 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; @@ -206,7 +202,6 @@ 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; @@ -231,8 +226,6 @@ 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; @@ -245,18 +238,6 @@ 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; @@ -302,13 +283,9 @@ 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; @@ -336,26 +313,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -395,7 +352,6 @@ 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; @@ -426,8 +382,6 @@ 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; @@ -443,8 +397,6 @@ 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; @@ -475,7 +427,6 @@ 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; @@ -497,22 +448,9 @@ 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; diff --git a/src/v1_25/api/core/v1/namespace.rs b/src/v1_25/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_25/api/core/v1/namespace.rs +++ b/src/v1_25/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_25/api/core/v1/node.rs b/src/v1_25/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_25/api/core/v1/node.rs +++ b/src/v1_25/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_25/api/core/v1/persistent_volume.rs b/src/v1_25/api/core/v1/persistent_volume.rs index c3d9dde5a2..7cb7fa7a7e 100644 --- a/src/v1_25/api/core/v1/persistent_volume.rs +++ b/src/v1_25/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; diff --git a/src/v1_25/api/core/v1/persistent_volume_claim.rs b/src/v1_25/api/core/v1/persistent_volume_claim.rs index e882129db9..f6ab75b14b 100644 --- a/src/v1_25/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_25/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_25/api/core/v1/pod.rs b/src/v1_25/api/core/v1/pod.rs index f99a63faa1..803af6a12a 100644 --- a/src/v1_25/api/core/v1/pod.rs +++ b/src/v1_25/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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 = ""; diff --git a/src/v1_25/api/core/v1/pod_template.rs b/src/v1_25/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_25/api/core/v1/pod_template.rs +++ b/src/v1_25/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_25/api/core/v1/replication_controller.rs b/src/v1_25/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_25/api/core/v1/replication_controller.rs +++ b/src/v1_25/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_25/api/core/v1/resource_quota.rs b/src/v1_25/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_25/api/core/v1/resource_quota.rs +++ b/src/v1_25/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_25/api/core/v1/secret.rs b/src/v1_25/api/core/v1/secret.rs index eb75155e0d..4c93df7798 100644 --- a/src/v1_25/api/core/v1/secret.rs +++ b/src/v1_25/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_25/api/core/v1/service.rs b/src/v1_25/api/core/v1/service.rs index d5b201c7a6..4add73225c 100644 --- a/src/v1_25/api/core/v1/service.rs +++ b/src/v1_25/api/core/v1/service.rs @@ -13,1169 +13,6 @@ pub struct Service { 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 = ""; diff --git a/src/v1_25/api/core/v1/service_account.rs b/src/v1_25/api/core/v1/service_account.rs index 1f966964fe..f9cc91ab51 100644 --- a/src/v1_25/api/core/v1/service_account.rs +++ b/src/v1_25/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_25/api/discovery/v1/endpoint_slice.rs b/src/v1_25/api/discovery/v1/endpoint_slice.rs index 033c1c4e60..ee595d764c 100644 --- a/src/v1_25/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_25/api/discovery/v1/endpoint_slice.rs @@ -17,458 +17,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_25/api/discovery/v1/mod.rs b/src/v1_25/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_25/api/discovery/v1/mod.rs +++ b/src/v1_25/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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/v1/event.rs b/src/v1_25/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_25/api/events/v1/event.rs +++ b/src/v1_25/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_25/api/events/v1/mod.rs b/src/v1_25/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_25/api/events/v1/mod.rs +++ b/src/v1_25/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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/v1beta1/flow_schema.rs b/src/v1_25/api/flowcontrol/v1beta1/flow_schema.rs index 1d0546a710..bc2d5f91b1 100644 --- a/src/v1_25/api/flowcontrol/v1beta1/flow_schema.rs +++ b/src/v1_25/api/flowcontrol/v1beta1/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_25/api/flowcontrol/v1beta1/mod.rs b/src/v1_25/api/flowcontrol/v1beta1/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_25/api/flowcontrol/v1beta1/mod.rs +++ b/src/v1_25/api/flowcontrol/v1beta1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs index 4cbe999e32..8546c26d30 100644 --- a/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs +++ b/src/v1_25/api/flowcontrol/v1beta1/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs index 71d13230a3..bb9f5a3a92 100644 --- a/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_25/api/flowcontrol/v1beta2/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_25/api/flowcontrol/v1beta2/mod.rs b/src/v1_25/api/flowcontrol/v1beta2/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_25/api/flowcontrol/v1beta2/mod.rs +++ b/src/v1_25/api/flowcontrol/v1beta2/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs index 91ebc9f1f5..2f8bb6a7cc 100644 --- a/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_25/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_25/api/networking/v1/ingress.rs b/src/v1_25/api/networking/v1/ingress.rs index c9e616121f..d97b30d97c 100644 --- a/src/v1_25/api/networking/v1/ingress.rs +++ b/src/v1_25/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_25/api/networking/v1/ingress_class.rs b/src/v1_25/api/networking/v1/ingress_class.rs index d3ab7820c7..c7206cf8f9 100644 --- a/src/v1_25/api/networking/v1/ingress_class.rs +++ b/src/v1_25/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_25/api/networking/v1/mod.rs b/src/v1_25/api/networking/v1/mod.rs index c8622860c4..e4792b2d2d 100644 --- a/src/v1_25/api/networking/v1/mod.rs +++ b/src/v1_25/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -43,8 +40,6 @@ 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; diff --git a/src/v1_25/api/networking/v1/network_policy.rs b/src/v1_25/api/networking/v1/network_policy.rs index 36ed661520..1370f27b72 100644 --- a/src/v1_25/api/networking/v1/network_policy.rs +++ b/src/v1_25/api/networking/v1/network_policy.rs @@ -13,629 +13,6 @@ pub struct NetworkPolicy { 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"; diff --git a/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs b/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs index bead0f8dcf..d8fab6b5aa 100644 --- a/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs +++ b/src/v1_25/api/networking/v1alpha1/cluster_cidr.rs @@ -10,342 +10,6 @@ pub struct ClusterCIDR { 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"; diff --git a/src/v1_25/api/networking/v1alpha1/mod.rs b/src/v1_25/api/networking/v1alpha1/mod.rs index c844d8c033..6921df8ffe 100644 --- a/src/v1_25/api/networking/v1alpha1/mod.rs +++ b/src/v1_25/api/networking/v1alpha1/mod.rs @@ -1,7 +1,6 @@ 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/v1/mod.rs b/src/v1_25/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_25/api/node/v1/mod.rs +++ b/src/v1_25/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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/runtime_class.rs b/src/v1_25/api/node/v1/runtime_class.rs index 470b9f902d..df33206097 100644 --- a/src/v1_25/api/node/v1/runtime_class.rs +++ b/src/v1_25/api/node/v1/runtime_class.rs @@ -17,342 +17,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_25/api/policy/v1/eviction.rs b/src/v1_25/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_25/api/policy/v1/eviction.rs +++ b/src/v1_25/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_25/api/policy/v1/mod.rs b/src/v1_25/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_25/api/policy/v1/mod.rs +++ b/src/v1_25/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_25/api/policy/v1/pod_disruption_budget.rs b/src/v1_25/api/policy/v1/pod_disruption_budget.rs index 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_25/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_25/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_25/api/rbac/v1/cluster_role.rs b/src/v1_25/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_25/api/rbac/v1/cluster_role.rs +++ b/src/v1_25/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; diff --git a/src/v1_25/api/rbac/v1/cluster_role_binding.rs b/src/v1_25/api/rbac/v1/cluster_role_binding.rs index 04fa2bd714..f35ae335c2 100644 --- a/src/v1_25/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_25/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_25/api/rbac/v1/mod.rs b/src/v1_25/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_25/api/rbac/v1/mod.rs +++ b/src/v1_25/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_25/api/rbac/v1/role.rs b/src/v1_25/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_25/api/rbac/v1/role.rs +++ b/src/v1_25/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_25/api/rbac/v1/role_binding.rs b/src/v1_25/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_25/api/rbac/v1/role_binding.rs +++ b/src/v1_25/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_25/api/scheduling/v1/mod.rs b/src/v1_25/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_25/api/scheduling/v1/mod.rs +++ b/src/v1_25/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ 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 index f13f535704..d6307206d0 100644 --- a/src/v1_25/api/scheduling/v1/priority_class.rs +++ b/src/v1_25/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_25/api/storage/v1/csi_driver.rs b/src/v1_25/api/storage/v1/csi_driver.rs index 0dc419fa28..b9bf9360f9 100644 --- a/src/v1_25/api/storage/v1/csi_driver.rs +++ b/src/v1_25/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_25/api/storage/v1/csi_node.rs b/src/v1_25/api/storage/v1/csi_node.rs index a514ce9bf0..92674e4267 100644 --- a/src/v1_25/api/storage/v1/csi_node.rs +++ b/src/v1_25/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; diff --git a/src/v1_25/api/storage/v1/csi_storage_capacity.rs b/src/v1_25/api/storage/v1/csi_storage_capacity.rs index 02efa5277e..024f4e5150 100644 --- a/src/v1_25/api/storage/v1/csi_storage_capacity.rs +++ b/src/v1_25/api/storage/v1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_25/api/storage/v1/mod.rs b/src/v1_25/api/storage/v1/mod.rs index 673d1d25b1..f0961497d2 100644 --- a/src/v1_25/api/storage/v1/mod.rs +++ b/src/v1_25/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,19 +16,15 @@ 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; diff --git a/src/v1_25/api/storage/v1/storage_class.rs b/src/v1_25/api/storage/v1/storage_class.rs index 12774ba320..1b39f75ad7 100644 --- a/src/v1_25/api/storage/v1/storage_class.rs +++ b/src/v1_25/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_25/api/storage/v1/volume_attachment.rs b/src/v1_25/api/storage/v1/volume_attachment.rs index f6b6972639..624ab4dbe0 100644 --- a/src/v1_25/api/storage/v1/volume_attachment.rs +++ b/src/v1_25/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; diff --git a/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs index 3fdc471ce4..cd7929263c 100644 --- a/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_25/api/storage/v1beta1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_25/api/storage/v1beta1/mod.rs b/src/v1_25/api/storage/v1beta1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_25/api/storage/v1beta1/mod.rs +++ b/src/v1_25/api/storage/v1beta1/mod.rs @@ -1,4 +1,3 @@ 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/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index c05e8ea174..be33903b77 100644 --- 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 @@ -13,495 +13,6 @@ pub struct 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"; 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 index 658cc6488f..25a7b1e212 100644 --- a/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_25/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_25/create_optional.rs b/src/v1_25/create_optional.rs deleted file mode 100644 index 0d7db46031..0000000000 --- a/src/v1_25/create_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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 deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_25/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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 deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_25/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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 deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_25/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 100644 --- 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 @@ -13,495 +13,6 @@ pub struct APIService { 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"; 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 index e48afb5807..57d836af46 100644 --- a/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_25/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_25/list_optional.rs b/src/v1_25/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_25/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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 deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_25/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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 index 4a7b2a9af5..27088faf3b 100644 --- a/src/v1_25/mod.rs +++ b/src/v1_25/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,2978 +9,3 @@ 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 deleted file mode 100644 index 803f498f6c..0000000000 --- a/src/v1_25/patch_optional.rs +++ /dev/null @@ -1,43 +0,0 @@ -// 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 deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_25/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 deleted file mode 100644 index 9a452099a7..0000000000 --- a/src/v1_25/replace_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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 deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_25/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 deleted file mode 100644 index cf0ebe7300..0000000000 --- a/src/v1_25/watch_optional.rs +++ /dev/null @@ -1,60 +0,0 @@ -// 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>, - - /// 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> 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", 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 deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_25/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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/src/v1_26/api/admissionregistration/v1/mod.rs b/src/v1_26/api/admissionregistration/v1/mod.rs index ace31fe7fb..4b1bbcbd9c 100644 --- a/src/v1_26/api/admissionregistration/v1/mod.rs +++ b/src/v1_26/api/admissionregistration/v1/mod.rs @@ -4,7 +4,6 @@ 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; @@ -17,7 +16,6 @@ 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_26/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_26/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_26/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_26/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; diff --git a/src/v1_26/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_26/api/admissionregistration/v1/validating_webhook_configuration.rs index ff20990424..f188208c4d 100644 --- a/src/v1_26/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_26/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_26/api/admissionregistration/v1alpha1/mod.rs b/src/v1_26/api/admissionregistration/v1alpha1/mod.rs index 614268d0b7..9008b25bd7 100644 --- a/src/v1_26/api/admissionregistration/v1alpha1/mod.rs +++ b/src/v1_26/api/admissionregistration/v1alpha1/mod.rs @@ -13,11 +13,9 @@ pub use self::param_ref::ParamRef; mod validating_admission_policy; pub use self::validating_admission_policy::ValidatingAdmissionPolicy; -#[cfg(feature = "api")] pub use self::validating_admission_policy::ReadValidatingAdmissionPolicyResponse; mod validating_admission_policy_binding; pub use self::validating_admission_policy_binding::ValidatingAdmissionPolicyBinding; -#[cfg(feature = "api")] pub use self::validating_admission_policy_binding::ReadValidatingAdmissionPolicyBindingResponse; mod validating_admission_policy_binding_spec; pub use self::validating_admission_policy_binding_spec::ValidatingAdmissionPolicyBindingSpec; diff --git a/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy.rs b/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy.rs index 68e0f477b1..9ad3cf79ba 100644 --- a/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy.rs +++ b/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy.rs @@ -10,342 +10,6 @@ pub struct ValidatingAdmissionPolicy { pub spec: Option, } -// Begin admissionregistration.k8s.io/v1alpha1/ValidatingAdmissionPolicy - -// Generated from operation createAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// create a ValidatingAdmissionPolicy - /// - /// 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::v1alpha1::ValidatingAdmissionPolicy, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies?".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 deleteAdmissionregistrationV1alpha1CollectionValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// delete collection of ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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 deleteAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// delete a ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `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/v1alpha1/validatingadmissionpolicies/{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 listAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// list or watch objects of kind ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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 patchAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// partially update the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `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/v1alpha1/validatingadmissionpolicies/{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 readAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// read the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingAdmissionPolicyResponse`]`>` constructor, or [`ReadValidatingAdmissionPolicyResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - #[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/v1alpha1/validatingadmissionpolicies/{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 [`ValidatingAdmissionPolicy::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadValidatingAdmissionPolicyResponse { - Ok(crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadValidatingAdmissionPolicyResponse { - 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((ReadValidatingAdmissionPolicyResponse::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((ReadValidatingAdmissionPolicyResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// replace the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{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 watchAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// list or watch objects of kind ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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/v1alpha1/ValidatingAdmissionPolicy - impl crate::Resource for ValidatingAdmissionPolicy { const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; const GROUP: &'static str = "admissionregistration.k8s.io"; diff --git a/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs b/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs index 4a9d872694..c195f6f49a 100644 --- a/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs +++ b/src/v1_26/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs @@ -10,342 +10,6 @@ pub struct ValidatingAdmissionPolicyBinding { pub spec: Option, } -// Begin admissionregistration.k8s.io/v1alpha1/ValidatingAdmissionPolicyBinding - -// Generated from operation createAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// create a ValidatingAdmissionPolicyBinding - /// - /// 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::v1alpha1::ValidatingAdmissionPolicyBinding, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings?".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 deleteAdmissionregistrationV1alpha1CollectionValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// delete collection of ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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 deleteAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// delete a ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `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/v1alpha1/validatingadmissionpolicybindings/{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 listAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// list or watch objects of kind ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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 patchAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// partially update the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `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/v1alpha1/validatingadmissionpolicybindings/{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 readAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// read the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingAdmissionPolicyBindingResponse`]`>` constructor, or [`ReadValidatingAdmissionPolicyBindingResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - #[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/v1alpha1/validatingadmissionpolicybindings/{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 [`ValidatingAdmissionPolicyBinding::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadValidatingAdmissionPolicyBindingResponse { - Ok(crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicyBinding), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadValidatingAdmissionPolicyBindingResponse { - 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((ReadValidatingAdmissionPolicyBindingResponse::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((ReadValidatingAdmissionPolicyBindingResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// replace the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicyBinding, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{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 watchAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// list or watch objects of kind ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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/v1alpha1/ValidatingAdmissionPolicyBinding - impl crate::Resource for ValidatingAdmissionPolicyBinding { const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; const GROUP: &'static str = "admissionregistration.k8s.io"; diff --git a/src/v1_26/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_26/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_26/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_26/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_26/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_26/api/apiserverinternal/v1alpha1/storage_version.rs index c5d811a2fd..447818b5bf 100644 --- a/src/v1_26/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_26/api/apiserverinternal/v1alpha1/storage_version.rs @@ -13,495 +13,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_26/api/apps/v1/controller_revision.rs b/src/v1_26/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_26/api/apps/v1/controller_revision.rs +++ b/src/v1_26/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_26/api/apps/v1/daemon_set.rs b/src/v1_26/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_26/api/apps/v1/daemon_set.rs +++ b/src/v1_26/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_26/api/apps/v1/deployment.rs b/src/v1_26/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_26/api/apps/v1/deployment.rs +++ b/src/v1_26/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_26/api/apps/v1/mod.rs b/src/v1_26/api/apps/v1/mod.rs index 953c5625f1..9471f6ea8a 100644 --- a/src/v1_26/api/apps/v1/mod.rs +++ b/src/v1_26/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_26/api/apps/v1/replica_set.rs b/src/v1_26/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_26/api/apps/v1/replica_set.rs +++ b/src/v1_26/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_26/api/apps/v1/stateful_set.rs b/src/v1_26/api/apps/v1/stateful_set.rs index 513df14954..d7a358f132 100644 --- a/src/v1_26/api/apps/v1/stateful_set.rs +++ b/src/v1_26/api/apps/v1/stateful_set.rs @@ -17,629 +17,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_26/api/authentication/v1/token_request.rs b/src/v1_26/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_26/api/authentication/v1/token_request.rs +++ b/src/v1_26/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_26/api/authentication/v1/token_review.rs b/src/v1_26/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_26/api/authentication/v1/token_review.rs +++ b/src/v1_26/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; diff --git a/src/v1_26/api/authentication/v1alpha1/self_subject_review.rs b/src/v1_26/api/authentication/v1alpha1/self_subject_review.rs index 0c1f7e1368..a67828c988 100644 --- a/src/v1_26/api/authentication/v1alpha1/self_subject_review.rs +++ b/src/v1_26/api/authentication/v1alpha1/self_subject_review.rs @@ -10,44 +10,6 @@ pub struct SelfSubjectReview { pub status: Option, } -// Begin authentication.k8s.io/v1alpha1/SelfSubjectReview - -// Generated from operation createAuthenticationV1alpha1SelfSubjectReview - -impl SelfSubjectReview { - /// create a SelfSubjectReview - /// - /// 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::v1alpha1::SelfSubjectReview, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/authentication.k8s.io/v1alpha1/selfsubjectreviews?".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/v1alpha1/SelfSubjectReview - impl crate::Resource for SelfSubjectReview { const API_VERSION: &'static str = "authentication.k8s.io/v1alpha1"; const GROUP: &'static str = "authentication.k8s.io"; diff --git a/src/v1_26/api/authorization/v1/local_subject_access_review.rs b/src/v1_26/api/authorization/v1/local_subject_access_review.rs index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_26/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_26/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; diff --git a/src/v1_26/api/authorization/v1/self_subject_access_review.rs b/src/v1_26/api/authorization/v1/self_subject_access_review.rs index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_26/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_26/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; diff --git a/src/v1_26/api/authorization/v1/self_subject_rules_review.rs b/src/v1_26/api/authorization/v1/self_subject_rules_review.rs index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_26/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_26/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_26/api/authorization/v1/subject_access_review.rs b/src/v1_26/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_26/api/authorization/v1/subject_access_review.rs +++ b/src/v1_26/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; diff --git a/src/v1_26/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_26/api/autoscaling/v1/horizontal_pod_autoscaler.rs index 01ee0ebcfc..79156137f7 100644 --- a/src/v1_26/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_26/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_26/api/autoscaling/v1/mod.rs b/src/v1_26/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_26/api/autoscaling/v1/mod.rs +++ b/src/v1_26/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_26/api/autoscaling/v1/scale.rs b/src/v1_26/api/autoscaling/v1/scale.rs index 89a7024529..8e96f95929 100644 --- a/src/v1_26/api/autoscaling/v1/scale.rs +++ b/src/v1_26/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; diff --git a/src/v1_26/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_26/api/autoscaling/v2/horizontal_pod_autoscaler.rs index e3df4c800c..e60e51dc10 100644 --- a/src/v1_26/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_26/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_26/api/autoscaling/v2/mod.rs b/src/v1_26/api/autoscaling/v2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_26/api/autoscaling/v2/mod.rs +++ b/src/v1_26/api/autoscaling/v2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_26/api/batch/v1/cron_job.rs b/src/v1_26/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_26/api/batch/v1/cron_job.rs +++ b/src/v1_26/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_26/api/batch/v1/job.rs b/src/v1_26/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_26/api/batch/v1/job.rs +++ b/src/v1_26/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_26/api/batch/v1/mod.rs b/src/v1_26/api/batch/v1/mod.rs index 09570f200d..689160fc0a 100644 --- a/src/v1_26/api/batch/v1/mod.rs +++ b/src/v1_26/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_26/api/certificates/v1/certificate_signing_request.rs b/src/v1_26/api/certificates/v1/certificate_signing_request.rs index 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_26/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_26/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_26/api/certificates/v1/mod.rs b/src/v1_26/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_26/api/certificates/v1/mod.rs +++ b/src/v1_26/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_26/api/coordination/v1/lease.rs b/src/v1_26/api/coordination/v1/lease.rs index 3e32685cbc..199762cc9a 100644 --- a/src/v1_26/api/coordination/v1/lease.rs +++ b/src/v1_26/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_26/api/coordination/v1/mod.rs b/src/v1_26/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_26/api/coordination/v1/mod.rs +++ b/src/v1_26/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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_26/api/core/v1/binding.rs b/src/v1_26/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_26/api/core/v1/binding.rs +++ b/src/v1_26/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_26/api/core/v1/component_status.rs b/src/v1_26/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_26/api/core/v1/component_status.rs +++ b/src/v1_26/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_26/api/core/v1/config_map.rs b/src/v1_26/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_26/api/core/v1/config_map.rs +++ b/src/v1_26/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_26/api/core/v1/endpoints.rs b/src/v1_26/api/core/v1/endpoints.rs index 74d95ffd83..3cb5e56421 100644 --- a/src/v1_26/api/core/v1/endpoints.rs +++ b/src/v1_26/api/core/v1/endpoints.rs @@ -22,458 +22,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_26/api/core/v1/event.rs b/src/v1_26/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_26/api/core/v1/event.rs +++ b/src/v1_26/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_26/api/core/v1/limit_range.rs b/src/v1_26/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_26/api/core/v1/limit_range.rs +++ b/src/v1_26/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_26/api/core/v1/mod.rs b/src/v1_26/api/core/v1/mod.rs index 5a551b7c91..ff542b3c8a 100644 --- a/src/v1_26/api/core/v1/mod.rs +++ b/src/v1_26/api/core/v1/mod.rs @@ -52,11 +52,9 @@ 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; @@ -123,7 +121,6 @@ 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; @@ -142,7 +139,6 @@ 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; @@ -209,7 +205,6 @@ 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; @@ -234,8 +229,6 @@ 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; @@ -248,18 +241,6 @@ 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; @@ -305,13 +286,9 @@ 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; @@ -339,26 +316,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -404,7 +361,6 @@ 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; @@ -435,8 +391,6 @@ 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; @@ -455,8 +409,6 @@ 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; @@ -487,7 +439,6 @@ 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; @@ -509,22 +460,9 @@ 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; diff --git a/src/v1_26/api/core/v1/namespace.rs b/src/v1_26/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_26/api/core/v1/namespace.rs +++ b/src/v1_26/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_26/api/core/v1/node.rs b/src/v1_26/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_26/api/core/v1/node.rs +++ b/src/v1_26/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_26/api/core/v1/persistent_volume.rs b/src/v1_26/api/core/v1/persistent_volume.rs index c3d9dde5a2..7cb7fa7a7e 100644 --- a/src/v1_26/api/core/v1/persistent_volume.rs +++ b/src/v1_26/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; diff --git a/src/v1_26/api/core/v1/persistent_volume_claim.rs b/src/v1_26/api/core/v1/persistent_volume_claim.rs index e882129db9..f6ab75b14b 100644 --- a/src/v1_26/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_26/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_26/api/core/v1/pod.rs b/src/v1_26/api/core/v1/pod.rs index f99a63faa1..803af6a12a 100644 --- a/src/v1_26/api/core/v1/pod.rs +++ b/src/v1_26/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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 = ""; diff --git a/src/v1_26/api/core/v1/pod_template.rs b/src/v1_26/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_26/api/core/v1/pod_template.rs +++ b/src/v1_26/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_26/api/core/v1/replication_controller.rs b/src/v1_26/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_26/api/core/v1/replication_controller.rs +++ b/src/v1_26/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_26/api/core/v1/resource_quota.rs b/src/v1_26/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_26/api/core/v1/resource_quota.rs +++ b/src/v1_26/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_26/api/core/v1/secret.rs b/src/v1_26/api/core/v1/secret.rs index eb75155e0d..4c93df7798 100644 --- a/src/v1_26/api/core/v1/secret.rs +++ b/src/v1_26/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_26/api/core/v1/service.rs b/src/v1_26/api/core/v1/service.rs index d5b201c7a6..4add73225c 100644 --- a/src/v1_26/api/core/v1/service.rs +++ b/src/v1_26/api/core/v1/service.rs @@ -13,1169 +13,6 @@ pub struct Service { 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 = ""; diff --git a/src/v1_26/api/core/v1/service_account.rs b/src/v1_26/api/core/v1/service_account.rs index 1f966964fe..f9cc91ab51 100644 --- a/src/v1_26/api/core/v1/service_account.rs +++ b/src/v1_26/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_26/api/discovery/v1/endpoint_slice.rs b/src/v1_26/api/discovery/v1/endpoint_slice.rs index 033c1c4e60..ee595d764c 100644 --- a/src/v1_26/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_26/api/discovery/v1/endpoint_slice.rs @@ -17,458 +17,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_26/api/discovery/v1/mod.rs b/src/v1_26/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_26/api/discovery/v1/mod.rs +++ b/src/v1_26/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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_26/api/events/v1/event.rs b/src/v1_26/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_26/api/events/v1/event.rs +++ b/src/v1_26/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_26/api/events/v1/mod.rs b/src/v1_26/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_26/api/events/v1/mod.rs +++ b/src/v1_26/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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_26/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_26/api/flowcontrol/v1beta2/flow_schema.rs index 71d13230a3..bb9f5a3a92 100644 --- a/src/v1_26/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_26/api/flowcontrol/v1beta2/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_26/api/flowcontrol/v1beta2/mod.rs b/src/v1_26/api/flowcontrol/v1beta2/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_26/api/flowcontrol/v1beta2/mod.rs +++ b/src/v1_26/api/flowcontrol/v1beta2/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_26/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_26/api/flowcontrol/v1beta2/priority_level_configuration.rs index 91ebc9f1f5..2f8bb6a7cc 100644 --- a/src/v1_26/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_26/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_26/api/flowcontrol/v1beta3/flow_schema.rs b/src/v1_26/api/flowcontrol/v1beta3/flow_schema.rs index 4890a5dcdc..4c0d0a63d4 100644 --- a/src/v1_26/api/flowcontrol/v1beta3/flow_schema.rs +++ b/src/v1_26/api/flowcontrol/v1beta3/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { pub status: Option, } -// Begin flowcontrol.apiserver.k8s.io/v1beta3/FlowSchema - -// Generated from operation createFlowcontrolApiserverV1beta3FlowSchema - -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::v1beta3::FlowSchema, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 deleteFlowcontrolApiserverV1beta3CollectionFlowSchema - -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/v1beta3/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 deleteFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 listFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3FlowSchemaStatus - -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/v1beta3/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 readFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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::v1beta3::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 readFlowcontrolApiserverV1beta3FlowSchemaStatus - -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/v1beta3/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::v1beta3::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 replaceFlowcontrolApiserverV1beta3FlowSchema - -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::v1beta3::FlowSchema, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 replaceFlowcontrolApiserverV1beta3FlowSchemaStatus - -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::v1beta3::FlowSchema, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 watchFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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/v1beta3/FlowSchema - impl crate::Resource for FlowSchema { const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; diff --git a/src/v1_26/api/flowcontrol/v1beta3/mod.rs b/src/v1_26/api/flowcontrol/v1beta3/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_26/api/flowcontrol/v1beta3/mod.rs +++ b/src/v1_26/api/flowcontrol/v1beta3/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_26/api/flowcontrol/v1beta3/priority_level_configuration.rs b/src/v1_26/api/flowcontrol/v1beta3/priority_level_configuration.rs index 381c85611d..4a78256215 100644 --- a/src/v1_26/api/flowcontrol/v1beta3/priority_level_configuration.rs +++ b/src/v1_26/api/flowcontrol/v1beta3/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { pub status: Option, } -// Begin flowcontrol.apiserver.k8s.io/v1beta3/PriorityLevelConfiguration - -// Generated from operation createFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 deleteFlowcontrolApiserverV1beta3CollectionPriorityLevelConfiguration - -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/v1beta3/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 deleteFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 listFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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/v1beta3/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 readFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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::v1beta3::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 readFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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/v1beta3/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::v1beta3::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 replaceFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 replaceFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 watchFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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/v1beta3/PriorityLevelConfiguration - impl crate::Resource for PriorityLevelConfiguration { const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; diff --git a/src/v1_26/api/networking/v1/ingress.rs b/src/v1_26/api/networking/v1/ingress.rs index c9e616121f..d97b30d97c 100644 --- a/src/v1_26/api/networking/v1/ingress.rs +++ b/src/v1_26/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_26/api/networking/v1/ingress_class.rs b/src/v1_26/api/networking/v1/ingress_class.rs index d3ab7820c7..c7206cf8f9 100644 --- a/src/v1_26/api/networking/v1/ingress_class.rs +++ b/src/v1_26/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_26/api/networking/v1/mod.rs b/src/v1_26/api/networking/v1/mod.rs index a7c2de91e6..9271b371de 100644 --- a/src/v1_26/api/networking/v1/mod.rs +++ b/src/v1_26/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -52,8 +49,6 @@ 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; diff --git a/src/v1_26/api/networking/v1/network_policy.rs b/src/v1_26/api/networking/v1/network_policy.rs index 36ed661520..1370f27b72 100644 --- a/src/v1_26/api/networking/v1/network_policy.rs +++ b/src/v1_26/api/networking/v1/network_policy.rs @@ -13,629 +13,6 @@ pub struct NetworkPolicy { 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"; diff --git a/src/v1_26/api/networking/v1alpha1/cluster_cidr.rs b/src/v1_26/api/networking/v1alpha1/cluster_cidr.rs index bead0f8dcf..d8fab6b5aa 100644 --- a/src/v1_26/api/networking/v1alpha1/cluster_cidr.rs +++ b/src/v1_26/api/networking/v1alpha1/cluster_cidr.rs @@ -10,342 +10,6 @@ pub struct ClusterCIDR { 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"; diff --git a/src/v1_26/api/networking/v1alpha1/mod.rs b/src/v1_26/api/networking/v1alpha1/mod.rs index c844d8c033..6921df8ffe 100644 --- a/src/v1_26/api/networking/v1alpha1/mod.rs +++ b/src/v1_26/api/networking/v1alpha1/mod.rs @@ -1,7 +1,6 @@ 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_26/api/node/v1/mod.rs b/src/v1_26/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_26/api/node/v1/mod.rs +++ b/src/v1_26/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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_26/api/node/v1/runtime_class.rs b/src/v1_26/api/node/v1/runtime_class.rs index 470b9f902d..df33206097 100644 --- a/src/v1_26/api/node/v1/runtime_class.rs +++ b/src/v1_26/api/node/v1/runtime_class.rs @@ -17,342 +17,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_26/api/policy/v1/eviction.rs b/src/v1_26/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_26/api/policy/v1/eviction.rs +++ b/src/v1_26/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_26/api/policy/v1/mod.rs b/src/v1_26/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_26/api/policy/v1/mod.rs +++ b/src/v1_26/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_26/api/policy/v1/pod_disruption_budget.rs b/src/v1_26/api/policy/v1/pod_disruption_budget.rs index 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_26/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_26/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_26/api/rbac/v1/cluster_role.rs b/src/v1_26/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_26/api/rbac/v1/cluster_role.rs +++ b/src/v1_26/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; diff --git a/src/v1_26/api/rbac/v1/cluster_role_binding.rs b/src/v1_26/api/rbac/v1/cluster_role_binding.rs index 04fa2bd714..f35ae335c2 100644 --- a/src/v1_26/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_26/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_26/api/rbac/v1/mod.rs b/src/v1_26/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_26/api/rbac/v1/mod.rs +++ b/src/v1_26/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_26/api/rbac/v1/role.rs b/src/v1_26/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_26/api/rbac/v1/role.rs +++ b/src/v1_26/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_26/api/rbac/v1/role_binding.rs b/src/v1_26/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_26/api/rbac/v1/role_binding.rs +++ b/src/v1_26/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_26/api/resource/v1alpha1/mod.rs b/src/v1_26/api/resource/v1alpha1/mod.rs index 4a181533a9..05c12f5c26 100644 --- a/src/v1_26/api/resource/v1alpha1/mod.rs +++ b/src/v1_26/api/resource/v1alpha1/mod.rs @@ -4,8 +4,6 @@ pub use self::allocation_result::AllocationResult; mod pod_scheduling; pub use self::pod_scheduling::PodScheduling; -#[cfg(feature = "api")] pub use self::pod_scheduling::ReadPodSchedulingResponse; -#[cfg(feature = "api")] pub use self::pod_scheduling::ReadPodSchedulingStatusResponse; mod pod_scheduling_spec; pub use self::pod_scheduling_spec::PodSchedulingSpec; @@ -15,8 +13,6 @@ pub use self::pod_scheduling_status::PodSchedulingStatus; mod resource_claim; pub use self::resource_claim::ResourceClaim; -#[cfg(feature = "api")] pub use self::resource_claim::ReadResourceClaimResponse; -#[cfg(feature = "api")] pub use self::resource_claim::ReadResourceClaimStatusResponse; mod resource_claim_consumer_reference; pub use self::resource_claim_consumer_reference::ResourceClaimConsumerReference; @@ -35,14 +31,12 @@ pub use self::resource_claim_status::ResourceClaimStatus; mod resource_claim_template; pub use self::resource_claim_template::ResourceClaimTemplate; -#[cfg(feature = "api")] pub use self::resource_claim_template::ReadResourceClaimTemplateResponse; mod resource_claim_template_spec; pub use self::resource_claim_template_spec::ResourceClaimTemplateSpec; mod resource_class; pub use self::resource_class::ResourceClass; -#[cfg(feature = "api")] pub use self::resource_class::ReadResourceClassResponse; mod resource_class_parameters_reference; pub use self::resource_class_parameters_reference::ResourceClassParametersReference; diff --git a/src/v1_26/api/resource/v1alpha1/pod_scheduling.rs b/src/v1_26/api/resource/v1alpha1/pod_scheduling.rs index 22e4c062e2..c54eb3182f 100644 --- a/src/v1_26/api/resource/v1alpha1/pod_scheduling.rs +++ b/src/v1_26/api/resource/v1alpha1/pod_scheduling.rs @@ -15,629 +15,6 @@ pub struct PodScheduling { pub status: Option, } -// Begin resource.k8s.io/v1alpha1/PodScheduling - -// Generated from operation createResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// create a PodScheduling - /// - /// 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::resource::v1alpha1::PodScheduling, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings?", - namespace = crate::percent_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 deleteResourceV1alpha1CollectionNamespacedPodScheduling - -impl PodScheduling { - /// delete collection of PodScheduling - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings?", - namespace = crate::percent_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 deleteResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// delete a PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 listResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// list or watch objects of kind PodScheduling - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings?", - namespace = crate::percent_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 listResourceV1alpha1PodSchedulingForAllNamespaces - -impl PodScheduling { - /// list or watch objects of kind PodScheduling - /// - /// 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/resource.k8s.io/v1alpha1/podschedulings?".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 patchResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// partially update the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 patchResourceV1alpha1NamespacedPodSchedulingStatus - -impl PodScheduling { - /// partially update status of the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 readResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// read the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSchedulingResponse`]`>` constructor, or [`ReadPodSchedulingResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 [`PodScheduling::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSchedulingResponse { - Ok(crate::api::resource::v1alpha1::PodScheduling), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSchedulingResponse { - 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((ReadPodSchedulingResponse::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((ReadPodSchedulingResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation readResourceV1alpha1NamespacedPodSchedulingStatus - -impl PodScheduling { - /// read status of the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSchedulingStatusResponse`]`>` constructor, or [`ReadPodSchedulingStatusResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 [`PodScheduling::read_status`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSchedulingStatusResponse { - Ok(crate::api::resource::v1alpha1::PodScheduling), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSchedulingStatusResponse { - 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((ReadPodSchedulingStatusResponse::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((ReadPodSchedulingStatusResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// replace the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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::resource::v1alpha1::PodScheduling, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 replaceResourceV1alpha1NamespacedPodSchedulingStatus - -impl PodScheduling { - /// replace status of the specified PodScheduling - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodScheduling - /// - /// * `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::resource::v1alpha1::PodScheduling, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings/{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 watchResourceV1alpha1NamespacedPodScheduling - -impl PodScheduling { - /// list or watch objects of kind PodScheduling - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/podschedulings?", - namespace = crate::percent_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 watchResourceV1alpha1PodSchedulingForAllNamespaces - -impl PodScheduling { - /// list or watch objects of kind PodScheduling - /// - /// 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/resource.k8s.io/v1alpha1/podschedulings?".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 resource.k8s.io/v1alpha1/PodScheduling - impl crate::Resource for PodScheduling { const API_VERSION: &'static str = "resource.k8s.io/v1alpha1"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_26/api/resource/v1alpha1/resource_claim.rs b/src/v1_26/api/resource/v1alpha1/resource_claim.rs index d296777d7a..71183051e0 100644 --- a/src/v1_26/api/resource/v1alpha1/resource_claim.rs +++ b/src/v1_26/api/resource/v1alpha1/resource_claim.rs @@ -15,629 +15,6 @@ pub struct ResourceClaim { pub status: Option, } -// Begin resource.k8s.io/v1alpha1/ResourceClaim - -// Generated from operation createResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// create a ResourceClaim - /// - /// 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::resource::v1alpha1::ResourceClaim, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 deleteResourceV1alpha1CollectionNamespacedResourceClaim - -impl ResourceClaim { - /// delete collection of ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 deleteResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// delete a ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 listResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 listResourceV1alpha1ResourceClaimForAllNamespaces - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha1/resourceclaims?".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 patchResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// partially update the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 patchResourceV1alpha1NamespacedResourceClaimStatus - -impl ResourceClaim { - /// partially update status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 readResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// read the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimResponse`]`>` constructor, or [`ReadResourceClaimResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 [`ResourceClaim::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimResponse { - Ok(crate::api::resource::v1alpha1::ResourceClaim), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimResponse { - 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((ReadResourceClaimResponse::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((ReadResourceClaimResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation readResourceV1alpha1NamespacedResourceClaimStatus - -impl ResourceClaim { - /// read status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimStatusResponse`]`>` constructor, or [`ReadResourceClaimStatusResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 [`ResourceClaim::read_status`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimStatusResponse { - Ok(crate::api::resource::v1alpha1::ResourceClaim), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimStatusResponse { - 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((ReadResourceClaimStatusResponse::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((ReadResourceClaimStatusResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// replace the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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::resource::v1alpha1::ResourceClaim, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 replaceResourceV1alpha1NamespacedResourceClaimStatus - -impl ResourceClaim { - /// replace status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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::resource::v1alpha1::ResourceClaim, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims/{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 watchResourceV1alpha1NamespacedResourceClaim - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 watchResourceV1alpha1ResourceClaimForAllNamespaces - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha1/resourceclaims?".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 resource.k8s.io/v1alpha1/ResourceClaim - impl crate::Resource for ResourceClaim { const API_VERSION: &'static str = "resource.k8s.io/v1alpha1"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_26/api/resource/v1alpha1/resource_claim_template.rs b/src/v1_26/api/resource/v1alpha1/resource_claim_template.rs index a6481042b4..04fb1c02ab 100644 --- a/src/v1_26/api/resource/v1alpha1/resource_claim_template.rs +++ b/src/v1_26/api/resource/v1alpha1/resource_claim_template.rs @@ -12,458 +12,6 @@ pub struct ResourceClaimTemplate { pub spec: crate::api::resource::v1alpha1::ResourceClaimTemplateSpec, } -// Begin resource.k8s.io/v1alpha1/ResourceClaimTemplate - -// Generated from operation createResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// create a ResourceClaimTemplate - /// - /// 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::resource::v1alpha1::ResourceClaimTemplate, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 deleteResourceV1alpha1CollectionNamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// delete collection of ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 deleteResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// delete a ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates/{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 listResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 listResourceV1alpha1ResourceClaimTemplateForAllNamespaces - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha1/resourceclaimtemplates?".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 patchResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// partially update the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates/{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 readResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// read the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimTemplateResponse`]`>` constructor, or [`ReadResourceClaimTemplateResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates/{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 [`ResourceClaimTemplate::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimTemplateResponse { - Ok(crate::api::resource::v1alpha1::ResourceClaimTemplate), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimTemplateResponse { - 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((ReadResourceClaimTemplateResponse::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((ReadResourceClaimTemplateResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// replace the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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::resource::v1alpha1::ResourceClaimTemplate, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates/{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 watchResourceV1alpha1NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha1/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 watchResourceV1alpha1ResourceClaimTemplateForAllNamespaces - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha1/resourceclaimtemplates?".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 resource.k8s.io/v1alpha1/ResourceClaimTemplate - impl crate::Resource for ResourceClaimTemplate { const API_VERSION: &'static str = "resource.k8s.io/v1alpha1"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_26/api/resource/v1alpha1/resource_class.rs b/src/v1_26/api/resource/v1alpha1/resource_class.rs index afffe54d8e..7b3422d5c3 100644 --- a/src/v1_26/api/resource/v1alpha1/resource_class.rs +++ b/src/v1_26/api/resource/v1alpha1/resource_class.rs @@ -22,342 +22,6 @@ pub struct ResourceClass { pub suitable_nodes: Option, } -// Begin resource.k8s.io/v1alpha1/ResourceClass - -// Generated from operation createResourceV1alpha1ResourceClass - -impl ResourceClass { - /// create a ResourceClass - /// - /// 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::resource::v1alpha1::ResourceClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/resource.k8s.io/v1alpha1/resourceclasses?".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 deleteResourceV1alpha1CollectionResourceClass - -impl ResourceClass { - /// delete collection of ResourceClass - /// - /// 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/resource.k8s.io/v1alpha1/resourceclasses?".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 deleteResourceV1alpha1ResourceClass - -impl ResourceClass { - /// delete a ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `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/resource.k8s.io/v1alpha1/resourceclasses/{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 listResourceV1alpha1ResourceClass - -impl ResourceClass { - /// list or watch objects of kind ResourceClass - /// - /// 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/resource.k8s.io/v1alpha1/resourceclasses?".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 patchResourceV1alpha1ResourceClass - -impl ResourceClass { - /// partially update the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `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/resource.k8s.io/v1alpha1/resourceclasses/{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 readResourceV1alpha1ResourceClass - -impl ResourceClass { - /// read the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClassResponse`]`>` constructor, or [`ReadResourceClassResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - #[cfg(feature = "api")] - pub fn read( - name: &str, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/resourceclasses/{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 [`ResourceClass::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClassResponse { - Ok(crate::api::resource::v1alpha1::ResourceClass), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClassResponse { - 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((ReadResourceClassResponse::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((ReadResourceClassResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha1ResourceClass - -impl ResourceClass { - /// replace the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::resource::v1alpha1::ResourceClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha1/resourceclasses/{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 watchResourceV1alpha1ResourceClass - -impl ResourceClass { - /// list or watch objects of kind ResourceClass - /// - /// 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/resource.k8s.io/v1alpha1/resourceclasses?".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 resource.k8s.io/v1alpha1/ResourceClass - impl crate::Resource for ResourceClass { const API_VERSION: &'static str = "resource.k8s.io/v1alpha1"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_26/api/scheduling/v1/mod.rs b/src/v1_26/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_26/api/scheduling/v1/mod.rs +++ b/src/v1_26/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_26/api/scheduling/v1/priority_class.rs b/src/v1_26/api/scheduling/v1/priority_class.rs index f13f535704..d6307206d0 100644 --- a/src/v1_26/api/scheduling/v1/priority_class.rs +++ b/src/v1_26/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_26/api/storage/v1/csi_driver.rs b/src/v1_26/api/storage/v1/csi_driver.rs index 0dc419fa28..b9bf9360f9 100644 --- a/src/v1_26/api/storage/v1/csi_driver.rs +++ b/src/v1_26/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_26/api/storage/v1/csi_node.rs b/src/v1_26/api/storage/v1/csi_node.rs index a514ce9bf0..92674e4267 100644 --- a/src/v1_26/api/storage/v1/csi_node.rs +++ b/src/v1_26/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; diff --git a/src/v1_26/api/storage/v1/csi_storage_capacity.rs b/src/v1_26/api/storage/v1/csi_storage_capacity.rs index 02efa5277e..024f4e5150 100644 --- a/src/v1_26/api/storage/v1/csi_storage_capacity.rs +++ b/src/v1_26/api/storage/v1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_26/api/storage/v1/mod.rs b/src/v1_26/api/storage/v1/mod.rs index 673d1d25b1..f0961497d2 100644 --- a/src/v1_26/api/storage/v1/mod.rs +++ b/src/v1_26/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,19 +16,15 @@ 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; diff --git a/src/v1_26/api/storage/v1/storage_class.rs b/src/v1_26/api/storage/v1/storage_class.rs index 12774ba320..1b39f75ad7 100644 --- a/src/v1_26/api/storage/v1/storage_class.rs +++ b/src/v1_26/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_26/api/storage/v1/volume_attachment.rs b/src/v1_26/api/storage/v1/volume_attachment.rs index f6b6972639..624ab4dbe0 100644 --- a/src/v1_26/api/storage/v1/volume_attachment.rs +++ b/src/v1_26/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; diff --git a/src/v1_26/api/storage/v1beta1/csi_storage_capacity.rs b/src/v1_26/api/storage/v1beta1/csi_storage_capacity.rs index 3fdc471ce4..cd7929263c 100644 --- a/src/v1_26/api/storage/v1beta1/csi_storage_capacity.rs +++ b/src/v1_26/api/storage/v1beta1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_26/api/storage/v1beta1/mod.rs b/src/v1_26/api/storage/v1beta1/mod.rs index a96a6424c7..fee2aadabe 100644 --- a/src/v1_26/api/storage/v1beta1/mod.rs +++ b/src/v1_26/api/storage/v1beta1/mod.rs @@ -1,4 +1,3 @@ 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_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index c05e8ea174..be33903b77 100644 --- a/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -13,495 +13,6 @@ pub struct 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"; diff --git a/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs index 658cc6488f..25a7b1e212 100644 --- a/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_26/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_26/create_optional.rs b/src/v1_26/create_optional.rs deleted file mode 100644 index 0d7db46031..0000000000 --- a/src/v1_26/create_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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_26/create_response.rs b/src/v1_26/create_response.rs deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_26/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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_26/delete_optional.rs b/src/v1_26/delete_optional.rs deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_26/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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_26/delete_response.rs b/src/v1_26/delete_response.rs deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_26/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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_26/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 100644 --- a/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -13,495 +13,6 @@ pub struct APIService { 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"; diff --git a/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs index e48afb5807..57d836af46 100644 --- a/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_26/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_26/list_optional.rs b/src/v1_26/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_26/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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_26/list_response.rs b/src/v1_26/list_response.rs deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_26/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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_26/mod.rs b/src/v1_26/mod.rs index 7f37582dbd..27088faf3b 100644 --- a/src/v1_26/mod.rs +++ b/src/v1_26/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,3146 +9,3 @@ 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 getAdmissionregistrationV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAdmissionregistrationV1alpha1APIResourcesResponse`]`>` constructor, or [`GetAdmissionregistrationV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_admissionregistration_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/admissionregistration.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_admissionregistration_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAdmissionregistrationV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAdmissionregistrationV1alpha1APIResourcesResponse { - 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((GetAdmissionregistrationV1alpha1APIResourcesResponse::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((GetAdmissionregistrationV1alpha1APIResourcesResponse::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 getAuthenticationV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthenticationV1alpha1APIResourcesResponse`]`>` constructor, or [`GetAuthenticationV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_authentication_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/authentication.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_authentication_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAuthenticationV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAuthenticationV1alpha1APIResourcesResponse { - 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((GetAuthenticationV1alpha1APIResourcesResponse::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((GetAuthenticationV1alpha1APIResourcesResponse::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 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 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 getFlowcontrolApiserverV1beta3APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetFlowcontrolApiserverV1beta3APIResourcesResponse`]`>` constructor, or [`GetFlowcontrolApiserverV1beta3APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_flowcontrol_apiserver_v1beta3_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/".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_v1beta3_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetFlowcontrolApiserverV1beta3APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetFlowcontrolApiserverV1beta3APIResourcesResponse { - 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((GetFlowcontrolApiserverV1beta3APIResourcesResponse::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((GetFlowcontrolApiserverV1beta3APIResourcesResponse::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 getResourceAPIGroup - -/// get information of a group -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetResourceAPIGroupResponse`]`>` constructor, or [`GetResourceAPIGroupResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_resource_api_group( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/resource.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_resource_api_group`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetResourceAPIGroupResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetResourceAPIGroupResponse { - 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((GetResourceAPIGroupResponse::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((GetResourceAPIGroupResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation getResourceV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetResourceV1alpha1APIResourcesResponse`]`>` constructor, or [`GetResourceV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_resource_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/resource.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_resource_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetResourceV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetResourceV1alpha1APIResourcesResponse { - 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((GetResourceV1alpha1APIResourcesResponse::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((GetResourceV1alpha1APIResourcesResponse::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_26/patch_optional.rs b/src/v1_26/patch_optional.rs deleted file mode 100644 index 803f498f6c..0000000000 --- a/src/v1_26/patch_optional.rs +++ /dev/null @@ -1,43 +0,0 @@ -// 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_26/patch_response.rs b/src/v1_26/patch_response.rs deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_26/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_26/replace_optional.rs b/src/v1_26/replace_optional.rs deleted file mode 100644 index 9a452099a7..0000000000 --- a/src/v1_26/replace_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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_26/replace_response.rs b/src/v1_26/replace_response.rs deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_26/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_26/watch_optional.rs b/src/v1_26/watch_optional.rs deleted file mode 100644 index cf0ebe7300..0000000000 --- a/src/v1_26/watch_optional.rs +++ /dev/null @@ -1,60 +0,0 @@ -// 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>, - - /// 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> 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", 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_26/watch_response.rs b/src/v1_26/watch_response.rs deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_26/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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/src/v1_27/api/admissionregistration/v1/mod.rs b/src/v1_27/api/admissionregistration/v1/mod.rs index fcc7935589..4480720674 100644 --- a/src/v1_27/api/admissionregistration/v1/mod.rs +++ b/src/v1_27/api/admissionregistration/v1/mod.rs @@ -7,7 +7,6 @@ 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; @@ -20,7 +19,6 @@ 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_27/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_27/api/admissionregistration/v1/mutating_webhook_configuration.rs index 156c7ccfcf..f2635a13ed 100644 --- a/src/v1_27/api/admissionregistration/v1/mutating_webhook_configuration.rs +++ b/src/v1_27/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct MutatingWebhookConfiguration { 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"; diff --git a/src/v1_27/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_27/api/admissionregistration/v1/validating_webhook_configuration.rs index ff20990424..f188208c4d 100644 --- a/src/v1_27/api/admissionregistration/v1/validating_webhook_configuration.rs +++ b/src/v1_27/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -10,342 +10,6 @@ pub struct ValidatingWebhookConfiguration { 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"; diff --git a/src/v1_27/api/admissionregistration/v1alpha1/mod.rs b/src/v1_27/api/admissionregistration/v1alpha1/mod.rs index 4d49fe7af4..367a898f08 100644 --- a/src/v1_27/api/admissionregistration/v1alpha1/mod.rs +++ b/src/v1_27/api/admissionregistration/v1alpha1/mod.rs @@ -25,12 +25,9 @@ pub use self::type_checking::TypeChecking; mod validating_admission_policy; pub use self::validating_admission_policy::ValidatingAdmissionPolicy; -#[cfg(feature = "api")] pub use self::validating_admission_policy::ReadValidatingAdmissionPolicyResponse; -#[cfg(feature = "api")] pub use self::validating_admission_policy::ReadValidatingAdmissionPolicyStatusResponse; mod validating_admission_policy_binding; pub use self::validating_admission_policy_binding::ValidatingAdmissionPolicyBinding; -#[cfg(feature = "api")] pub use self::validating_admission_policy_binding::ReadValidatingAdmissionPolicyBindingResponse; mod validating_admission_policy_binding_spec; pub use self::validating_admission_policy_binding_spec::ValidatingAdmissionPolicyBindingSpec; diff --git a/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy.rs b/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy.rs index 7a9b5a36e3..3dbce5aba2 100644 --- a/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy.rs +++ b/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy.rs @@ -13,495 +13,6 @@ pub struct ValidatingAdmissionPolicy { pub status: Option, } -// Begin admissionregistration.k8s.io/v1alpha1/ValidatingAdmissionPolicy - -// Generated from operation createAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// create a ValidatingAdmissionPolicy - /// - /// 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::v1alpha1::ValidatingAdmissionPolicy, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies?".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 deleteAdmissionregistrationV1alpha1CollectionValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// delete collection of ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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 deleteAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// delete a ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `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/v1alpha1/validatingadmissionpolicies/{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 listAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// list or watch objects of kind ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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 patchAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// partially update the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `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/v1alpha1/validatingadmissionpolicies/{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 patchAdmissionregistrationV1alpha1ValidatingAdmissionPolicyStatus - -impl ValidatingAdmissionPolicy { - /// partially update status of the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `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/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{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 readAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// read the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingAdmissionPolicyResponse`]`>` constructor, or [`ReadValidatingAdmissionPolicyResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - #[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/v1alpha1/validatingadmissionpolicies/{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 [`ValidatingAdmissionPolicy::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadValidatingAdmissionPolicyResponse { - Ok(crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadValidatingAdmissionPolicyResponse { - 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((ReadValidatingAdmissionPolicyResponse::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((ReadValidatingAdmissionPolicyResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation readAdmissionregistrationV1alpha1ValidatingAdmissionPolicyStatus - -impl ValidatingAdmissionPolicy { - /// read status of the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingAdmissionPolicyStatusResponse`]`>` constructor, or [`ReadValidatingAdmissionPolicyStatusResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - #[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/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{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 [`ValidatingAdmissionPolicy::read_status`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadValidatingAdmissionPolicyStatusResponse { - Ok(crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadValidatingAdmissionPolicyStatusResponse { - 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((ReadValidatingAdmissionPolicyStatusResponse::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((ReadValidatingAdmissionPolicyStatusResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// replace the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{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 replaceAdmissionregistrationV1alpha1ValidatingAdmissionPolicyStatus - -impl ValidatingAdmissionPolicy { - /// replace status of the specified ValidatingAdmissionPolicy - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicy - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace_status( - name: &str, - body: &crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicy, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{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 watchAdmissionregistrationV1alpha1ValidatingAdmissionPolicy - -impl ValidatingAdmissionPolicy { - /// list or watch objects of kind ValidatingAdmissionPolicy - /// - /// 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/v1alpha1/validatingadmissionpolicies?".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/v1alpha1/ValidatingAdmissionPolicy - impl crate::Resource for ValidatingAdmissionPolicy { const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; const GROUP: &'static str = "admissionregistration.k8s.io"; diff --git a/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs b/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs index 4a9d872694..c195f6f49a 100644 --- a/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs +++ b/src/v1_27/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs @@ -10,342 +10,6 @@ pub struct ValidatingAdmissionPolicyBinding { pub spec: Option, } -// Begin admissionregistration.k8s.io/v1alpha1/ValidatingAdmissionPolicyBinding - -// Generated from operation createAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// create a ValidatingAdmissionPolicyBinding - /// - /// 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::v1alpha1::ValidatingAdmissionPolicyBinding, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings?".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 deleteAdmissionregistrationV1alpha1CollectionValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// delete collection of ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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 deleteAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// delete a ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `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/v1alpha1/validatingadmissionpolicybindings/{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 listAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// list or watch objects of kind ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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 patchAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// partially update the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `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/v1alpha1/validatingadmissionpolicybindings/{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 readAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// read the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadValidatingAdmissionPolicyBindingResponse`]`>` constructor, or [`ReadValidatingAdmissionPolicyBindingResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - #[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/v1alpha1/validatingadmissionpolicybindings/{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 [`ValidatingAdmissionPolicyBinding::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadValidatingAdmissionPolicyBindingResponse { - Ok(crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicyBinding), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadValidatingAdmissionPolicyBindingResponse { - 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((ReadValidatingAdmissionPolicyBindingResponse::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((ReadValidatingAdmissionPolicyBindingResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// replace the specified ValidatingAdmissionPolicyBinding - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ValidatingAdmissionPolicyBinding - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::admissionregistration::v1alpha1::ValidatingAdmissionPolicyBinding, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{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 watchAdmissionregistrationV1alpha1ValidatingAdmissionPolicyBinding - -impl ValidatingAdmissionPolicyBinding { - /// list or watch objects of kind ValidatingAdmissionPolicyBinding - /// - /// 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/v1alpha1/validatingadmissionpolicybindings?".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/v1alpha1/ValidatingAdmissionPolicyBinding - impl crate::Resource for ValidatingAdmissionPolicyBinding { const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; const GROUP: &'static str = "admissionregistration.k8s.io"; diff --git a/src/v1_27/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_27/api/apiserverinternal/v1alpha1/mod.rs index 28bc9cd304..ac49a06a02 100644 --- a/src/v1_27/api/apiserverinternal/v1alpha1/mod.rs +++ b/src/v1_27/api/apiserverinternal/v1alpha1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_27/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_27/api/apiserverinternal/v1alpha1/storage_version.rs index c5d811a2fd..447818b5bf 100644 --- a/src/v1_27/api/apiserverinternal/v1alpha1/storage_version.rs +++ b/src/v1_27/api/apiserverinternal/v1alpha1/storage_version.rs @@ -13,495 +13,6 @@ pub struct StorageVersion { 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"; diff --git a/src/v1_27/api/apps/v1/controller_revision.rs b/src/v1_27/api/apps/v1/controller_revision.rs index fa18bb2583..e2e66790ef 100644 --- a/src/v1_27/api/apps/v1/controller_revision.rs +++ b/src/v1_27/api/apps/v1/controller_revision.rs @@ -13,458 +13,6 @@ pub struct ControllerRevision { 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"; diff --git a/src/v1_27/api/apps/v1/daemon_set.rs b/src/v1_27/api/apps/v1/daemon_set.rs index 6a782f979d..b1b5ea726b 100644 --- a/src/v1_27/api/apps/v1/daemon_set.rs +++ b/src/v1_27/api/apps/v1/daemon_set.rs @@ -13,629 +13,6 @@ pub struct DaemonSet { 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"; diff --git a/src/v1_27/api/apps/v1/deployment.rs b/src/v1_27/api/apps/v1/deployment.rs index f8d215b273..c70dc8e424 100644 --- a/src/v1_27/api/apps/v1/deployment.rs +++ b/src/v1_27/api/apps/v1/deployment.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_27/api/apps/v1/mod.rs b/src/v1_27/api/apps/v1/mod.rs index 953c5625f1..9471f6ea8a 100644 --- a/src/v1_27/api/apps/v1/mod.rs +++ b/src/v1_27/api/apps/v1/mod.rs @@ -1,12 +1,9 @@ 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; @@ -22,8 +19,6 @@ 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; @@ -39,8 +34,6 @@ 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; @@ -62,8 +55,6 @@ pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStra 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; diff --git a/src/v1_27/api/apps/v1/replica_set.rs b/src/v1_27/api/apps/v1/replica_set.rs index 41a72f7b44..fd169d56af 100644 --- a/src/v1_27/api/apps/v1/replica_set.rs +++ b/src/v1_27/api/apps/v1/replica_set.rs @@ -13,629 +13,6 @@ pub struct ReplicaSet { 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"; diff --git a/src/v1_27/api/apps/v1/stateful_set.rs b/src/v1_27/api/apps/v1/stateful_set.rs index 513df14954..d7a358f132 100644 --- a/src/v1_27/api/apps/v1/stateful_set.rs +++ b/src/v1_27/api/apps/v1/stateful_set.rs @@ -17,629 +17,6 @@ pub struct StatefulSet { 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"; diff --git a/src/v1_27/api/authentication/v1/token_request.rs b/src/v1_27/api/authentication/v1/token_request.rs index 1f864e2ac3..1e7bde4f73 100644 --- a/src/v1_27/api/authentication/v1/token_request.rs +++ b/src/v1_27/api/authentication/v1/token_request.rs @@ -13,57 +13,6 @@ pub struct TokenRequest { 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"; diff --git a/src/v1_27/api/authentication/v1/token_review.rs b/src/v1_27/api/authentication/v1/token_review.rs index e4ed490482..cfe4c90a42 100644 --- a/src/v1_27/api/authentication/v1/token_review.rs +++ b/src/v1_27/api/authentication/v1/token_review.rs @@ -13,44 +13,6 @@ pub struct TokenReview { 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"; diff --git a/src/v1_27/api/authentication/v1alpha1/self_subject_review.rs b/src/v1_27/api/authentication/v1alpha1/self_subject_review.rs index 80fdeaa033..1f41b04f50 100644 --- a/src/v1_27/api/authentication/v1alpha1/self_subject_review.rs +++ b/src/v1_27/api/authentication/v1alpha1/self_subject_review.rs @@ -10,44 +10,6 @@ pub struct SelfSubjectReview { pub status: Option, } -// Begin authentication.k8s.io/v1alpha1/SelfSubjectReview - -// Generated from operation createAuthenticationV1alpha1SelfSubjectReview - -impl SelfSubjectReview { - /// create a SelfSubjectReview - /// - /// 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::v1alpha1::SelfSubjectReview, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/authentication.k8s.io/v1alpha1/selfsubjectreviews?".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/v1alpha1/SelfSubjectReview - impl crate::Resource for SelfSubjectReview { const API_VERSION: &'static str = "authentication.k8s.io/v1alpha1"; const GROUP: &'static str = "authentication.k8s.io"; diff --git a/src/v1_27/api/authentication/v1beta1/self_subject_review.rs b/src/v1_27/api/authentication/v1beta1/self_subject_review.rs index fbe1b99780..b9ec965a55 100644 --- a/src/v1_27/api/authentication/v1beta1/self_subject_review.rs +++ b/src/v1_27/api/authentication/v1beta1/self_subject_review.rs @@ -10,44 +10,6 @@ pub struct SelfSubjectReview { pub status: Option, } -// Begin authentication.k8s.io/v1beta1/SelfSubjectReview - -// Generated from operation createAuthenticationV1beta1SelfSubjectReview - -impl SelfSubjectReview { - /// create a SelfSubjectReview - /// - /// 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::v1beta1::SelfSubjectReview, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/authentication.k8s.io/v1beta1/selfsubjectreviews?".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/v1beta1/SelfSubjectReview - impl crate::Resource for SelfSubjectReview { const API_VERSION: &'static str = "authentication.k8s.io/v1beta1"; const GROUP: &'static str = "authentication.k8s.io"; diff --git a/src/v1_27/api/authorization/v1/local_subject_access_review.rs b/src/v1_27/api/authorization/v1/local_subject_access_review.rs index 53e620a9f8..8c7fcfb432 100644 --- a/src/v1_27/api/authorization/v1/local_subject_access_review.rs +++ b/src/v1_27/api/authorization/v1/local_subject_access_review.rs @@ -13,51 +13,6 @@ pub struct LocalSubjectAccessReview { 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"; diff --git a/src/v1_27/api/authorization/v1/self_subject_access_review.rs b/src/v1_27/api/authorization/v1/self_subject_access_review.rs index bf549beb13..b1a2b7c2d7 100644 --- a/src/v1_27/api/authorization/v1/self_subject_access_review.rs +++ b/src/v1_27/api/authorization/v1/self_subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectAccessReview { 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"; diff --git a/src/v1_27/api/authorization/v1/self_subject_rules_review.rs b/src/v1_27/api/authorization/v1/self_subject_rules_review.rs index 60defd6f35..1a821f5aeb 100644 --- a/src/v1_27/api/authorization/v1/self_subject_rules_review.rs +++ b/src/v1_27/api/authorization/v1/self_subject_rules_review.rs @@ -13,44 +13,6 @@ pub struct SelfSubjectRulesReview { 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"; diff --git a/src/v1_27/api/authorization/v1/subject_access_review.rs b/src/v1_27/api/authorization/v1/subject_access_review.rs index 8735a9f0bc..6fa3434c21 100644 --- a/src/v1_27/api/authorization/v1/subject_access_review.rs +++ b/src/v1_27/api/authorization/v1/subject_access_review.rs @@ -13,44 +13,6 @@ pub struct SubjectAccessReview { 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"; diff --git a/src/v1_27/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_27/api/autoscaling/v1/horizontal_pod_autoscaler.rs index 7d2a2eae00..7052aebdb9 100644 --- a/src/v1_27/api/autoscaling/v1/horizontal_pod_autoscaler.rs +++ b/src/v1_27/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_27/api/autoscaling/v1/mod.rs b/src/v1_27/api/autoscaling/v1/mod.rs index d2b01e62d7..3ad43beb80 100644 --- a/src/v1_27/api/autoscaling/v1/mod.rs +++ b/src/v1_27/api/autoscaling/v1/mod.rs @@ -4,8 +4,6 @@ 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; @@ -15,10 +13,6 @@ 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; diff --git a/src/v1_27/api/autoscaling/v1/scale.rs b/src/v1_27/api/autoscaling/v1/scale.rs index 4dc6013cce..04cd37e6f6 100644 --- a/src/v1_27/api/autoscaling/v1/scale.rs +++ b/src/v1_27/api/autoscaling/v1/scale.rs @@ -13,694 +13,6 @@ pub struct Scale { 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"; diff --git a/src/v1_27/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_27/api/autoscaling/v2/horizontal_pod_autoscaler.rs index e3df4c800c..e60e51dc10 100644 --- a/src/v1_27/api/autoscaling/v2/horizontal_pod_autoscaler.rs +++ b/src/v1_27/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -13,629 +13,6 @@ pub struct HorizontalPodAutoscaler { 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"; diff --git a/src/v1_27/api/autoscaling/v2/mod.rs b/src/v1_27/api/autoscaling/v2/mod.rs index 3f5b00bce4..9e4929efec 100644 --- a/src/v1_27/api/autoscaling/v2/mod.rs +++ b/src/v1_27/api/autoscaling/v2/mod.rs @@ -22,8 +22,6 @@ 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; diff --git a/src/v1_27/api/batch/v1/cron_job.rs b/src/v1_27/api/batch/v1/cron_job.rs index 7d5e4f4f63..9836c15492 100644 --- a/src/v1_27/api/batch/v1/cron_job.rs +++ b/src/v1_27/api/batch/v1/cron_job.rs @@ -13,629 +13,6 @@ pub struct CronJob { 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"; diff --git a/src/v1_27/api/batch/v1/job.rs b/src/v1_27/api/batch/v1/job.rs index 255eab956e..533eebfaed 100644 --- a/src/v1_27/api/batch/v1/job.rs +++ b/src/v1_27/api/batch/v1/job.rs @@ -13,629 +13,6 @@ pub struct Job { 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"; diff --git a/src/v1_27/api/batch/v1/mod.rs b/src/v1_27/api/batch/v1/mod.rs index 09570f200d..689160fc0a 100644 --- a/src/v1_27/api/batch/v1/mod.rs +++ b/src/v1_27/api/batch/v1/mod.rs @@ -1,8 +1,6 @@ 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; @@ -12,8 +10,6 @@ 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; diff --git a/src/v1_27/api/certificates/v1/certificate_signing_request.rs b/src/v1_27/api/certificates/v1/certificate_signing_request.rs index 066a900b7c..c2bdd59ab2 100644 --- a/src/v1_27/api/certificates/v1/certificate_signing_request.rs +++ b/src/v1_27/api/certificates/v1/certificate_signing_request.rs @@ -18,648 +18,6 @@ pub struct CertificateSigningRequest { 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"; diff --git a/src/v1_27/api/certificates/v1/mod.rs b/src/v1_27/api/certificates/v1/mod.rs index 57fbb438b7..4e57ebf3d0 100644 --- a/src/v1_27/api/certificates/v1/mod.rs +++ b/src/v1_27/api/certificates/v1/mod.rs @@ -1,9 +1,6 @@ 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; diff --git a/src/v1_27/api/certificates/v1alpha1/cluster_trust_bundle.rs b/src/v1_27/api/certificates/v1alpha1/cluster_trust_bundle.rs index 2edc8b71ac..0a0363b696 100644 --- a/src/v1_27/api/certificates/v1alpha1/cluster_trust_bundle.rs +++ b/src/v1_27/api/certificates/v1alpha1/cluster_trust_bundle.rs @@ -14,342 +14,6 @@ pub struct ClusterTrustBundle { pub spec: crate::api::certificates::v1alpha1::ClusterTrustBundleSpec, } -// Begin certificates.k8s.io/v1alpha1/ClusterTrustBundle - -// Generated from operation createCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// create a ClusterTrustBundle - /// - /// 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::v1alpha1::ClusterTrustBundle, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/certificates.k8s.io/v1alpha1/clustertrustbundles?".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 deleteCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// delete a ClusterTrustBundle - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ClusterTrustBundle - /// - /// * `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/v1alpha1/clustertrustbundles/{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 deleteCertificatesV1alpha1CollectionClusterTrustBundle - -impl ClusterTrustBundle { - /// delete collection of ClusterTrustBundle - /// - /// 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/v1alpha1/clustertrustbundles?".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 listCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// list or watch objects of kind ClusterTrustBundle - /// - /// 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/v1alpha1/clustertrustbundles?".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 patchCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// partially update the specified ClusterTrustBundle - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ClusterTrustBundle - /// - /// * `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/v1alpha1/clustertrustbundles/{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 readCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// read the specified ClusterTrustBundle - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadClusterTrustBundleResponse`]`>` constructor, or [`ReadClusterTrustBundleResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ClusterTrustBundle - #[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/v1alpha1/clustertrustbundles/{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 [`ClusterTrustBundle::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadClusterTrustBundleResponse { - Ok(crate::api::certificates::v1alpha1::ClusterTrustBundle), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadClusterTrustBundleResponse { - 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((ReadClusterTrustBundleResponse::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((ReadClusterTrustBundleResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// replace the specified ClusterTrustBundle - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ClusterTrustBundle - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::certificates::v1alpha1::ClusterTrustBundle, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/certificates.k8s.io/v1alpha1/clustertrustbundles/{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 watchCertificatesV1alpha1ClusterTrustBundle - -impl ClusterTrustBundle { - /// list or watch objects of kind ClusterTrustBundle - /// - /// 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/v1alpha1/clustertrustbundles?".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/v1alpha1/ClusterTrustBundle - impl crate::Resource for ClusterTrustBundle { const API_VERSION: &'static str = "certificates.k8s.io/v1alpha1"; const GROUP: &'static str = "certificates.k8s.io"; diff --git a/src/v1_27/api/certificates/v1alpha1/mod.rs b/src/v1_27/api/certificates/v1alpha1/mod.rs index 81ce9f7158..b26a6ecae6 100644 --- a/src/v1_27/api/certificates/v1alpha1/mod.rs +++ b/src/v1_27/api/certificates/v1alpha1/mod.rs @@ -1,7 +1,6 @@ mod cluster_trust_bundle; pub use self::cluster_trust_bundle::ClusterTrustBundle; -#[cfg(feature = "api")] pub use self::cluster_trust_bundle::ReadClusterTrustBundleResponse; mod cluster_trust_bundle_spec; pub use self::cluster_trust_bundle_spec::ClusterTrustBundleSpec; diff --git a/src/v1_27/api/coordination/v1/lease.rs b/src/v1_27/api/coordination/v1/lease.rs index feb10360ed..f4eecc0b56 100644 --- a/src/v1_27/api/coordination/v1/lease.rs +++ b/src/v1_27/api/coordination/v1/lease.rs @@ -10,458 +10,6 @@ pub struct Lease { 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"; diff --git a/src/v1_27/api/coordination/v1/mod.rs b/src/v1_27/api/coordination/v1/mod.rs index 9660aabbb8..44537141f8 100644 --- a/src/v1_27/api/coordination/v1/mod.rs +++ b/src/v1_27/api/coordination/v1/mod.rs @@ -1,7 +1,6 @@ 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_27/api/core/v1/binding.rs b/src/v1_27/api/core/v1/binding.rs index b3aeda2f48..e85e0e64f3 100644 --- a/src/v1_27/api/core/v1/binding.rs +++ b/src/v1_27/api/core/v1/binding.rs @@ -10,98 +10,6 @@ pub struct Binding { 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 = ""; diff --git a/src/v1_27/api/core/v1/component_status.rs b/src/v1_27/api/core/v1/component_status.rs index 50e55665e4..60edb5a7f6 100644 --- a/src/v1_27/api/core/v1/component_status.rs +++ b/src/v1_27/api/core/v1/component_status.rs @@ -10,141 +10,6 @@ pub struct ComponentStatus { 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 = ""; diff --git a/src/v1_27/api/core/v1/config_map.rs b/src/v1_27/api/core/v1/config_map.rs index 7d07e59a99..2916159f82 100644 --- a/src/v1_27/api/core/v1/config_map.rs +++ b/src/v1_27/api/core/v1/config_map.rs @@ -16,458 +16,6 @@ pub struct ConfigMap { 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 = ""; diff --git a/src/v1_27/api/core/v1/endpoints.rs b/src/v1_27/api/core/v1/endpoints.rs index 74d95ffd83..3cb5e56421 100644 --- a/src/v1_27/api/core/v1/endpoints.rs +++ b/src/v1_27/api/core/v1/endpoints.rs @@ -22,458 +22,6 @@ pub struct Endpoints { 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 = ""; diff --git a/src/v1_27/api/core/v1/event.rs b/src/v1_27/api/core/v1/event.rs index d6f2ae1243..6397f0bd8a 100644 --- a/src/v1_27/api/core/v1/event.rs +++ b/src/v1_27/api/core/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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 = ""; diff --git a/src/v1_27/api/core/v1/limit_range.rs b/src/v1_27/api/core/v1/limit_range.rs index 8cb5242d90..f02b39ccd8 100644 --- a/src/v1_27/api/core/v1/limit_range.rs +++ b/src/v1_27/api/core/v1/limit_range.rs @@ -10,458 +10,6 @@ pub struct LimitRange { 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 = ""; diff --git a/src/v1_27/api/core/v1/mod.rs b/src/v1_27/api/core/v1/mod.rs index 1773fdc8ad..a174128528 100644 --- a/src/v1_27/api/core/v1/mod.rs +++ b/src/v1_27/api/core/v1/mod.rs @@ -52,11 +52,9 @@ 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; @@ -126,7 +124,6 @@ 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; @@ -145,7 +142,6 @@ 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; @@ -212,7 +208,6 @@ 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; @@ -237,8 +232,6 @@ 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; @@ -251,18 +244,6 @@ 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; @@ -308,13 +289,9 @@ 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; @@ -342,26 +319,6 @@ pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSo 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; @@ -407,7 +364,6 @@ 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; @@ -438,8 +394,6 @@ 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; @@ -458,8 +412,6 @@ 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; @@ -490,7 +442,6 @@ 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; @@ -512,22 +463,9 @@ 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; diff --git a/src/v1_27/api/core/v1/namespace.rs b/src/v1_27/api/core/v1/namespace.rs index df31cdc0da..e8af4455f9 100644 --- a/src/v1_27/api/core/v1/namespace.rs +++ b/src/v1_27/api/core/v1/namespace.rs @@ -13,495 +13,6 @@ pub struct Namespace { 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 = ""; diff --git a/src/v1_27/api/core/v1/node.rs b/src/v1_27/api/core/v1/node.rs index 5a5694b818..e78962958e 100644 --- a/src/v1_27/api/core/v1/node.rs +++ b/src/v1_27/api/core/v1/node.rs @@ -13,975 +13,6 @@ pub struct Node { 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 = ""; diff --git a/src/v1_27/api/core/v1/persistent_volume.rs b/src/v1_27/api/core/v1/persistent_volume.rs index c3d9dde5a2..7cb7fa7a7e 100644 --- a/src/v1_27/api/core/v1/persistent_volume.rs +++ b/src/v1_27/api/core/v1/persistent_volume.rs @@ -13,495 +13,6 @@ pub struct PersistentVolume { 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 = ""; diff --git a/src/v1_27/api/core/v1/persistent_volume_claim.rs b/src/v1_27/api/core/v1/persistent_volume_claim.rs index e882129db9..f6ab75b14b 100644 --- a/src/v1_27/api/core/v1/persistent_volume_claim.rs +++ b/src/v1_27/api/core/v1/persistent_volume_claim.rs @@ -13,629 +13,6 @@ pub struct PersistentVolumeClaim { 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 = ""; diff --git a/src/v1_27/api/core/v1/pod.rs b/src/v1_27/api/core/v1/pod.rs index f99a63faa1..803af6a12a 100644 --- a/src/v1_27/api/core/v1/pod.rs +++ b/src/v1_27/api/core/v1/pod.rs @@ -13,1902 +13,6 @@ pub struct Pod { 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 = ""; diff --git a/src/v1_27/api/core/v1/pod_template.rs b/src/v1_27/api/core/v1/pod_template.rs index 5ce465ce2e..05822b28a0 100644 --- a/src/v1_27/api/core/v1/pod_template.rs +++ b/src/v1_27/api/core/v1/pod_template.rs @@ -10,458 +10,6 @@ pub struct PodTemplate { 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 = ""; diff --git a/src/v1_27/api/core/v1/replication_controller.rs b/src/v1_27/api/core/v1/replication_controller.rs index 613bdd6f41..a84e2c968a 100644 --- a/src/v1_27/api/core/v1/replication_controller.rs +++ b/src/v1_27/api/core/v1/replication_controller.rs @@ -13,629 +13,6 @@ pub struct ReplicationController { 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 = ""; diff --git a/src/v1_27/api/core/v1/resource_quota.rs b/src/v1_27/api/core/v1/resource_quota.rs index fac2dbab5e..9950292127 100644 --- a/src/v1_27/api/core/v1/resource_quota.rs +++ b/src/v1_27/api/core/v1/resource_quota.rs @@ -13,629 +13,6 @@ pub struct ResourceQuota { 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 = ""; diff --git a/src/v1_27/api/core/v1/secret.rs b/src/v1_27/api/core/v1/secret.rs index eb75155e0d..4c93df7798 100644 --- a/src/v1_27/api/core/v1/secret.rs +++ b/src/v1_27/api/core/v1/secret.rs @@ -19,458 +19,6 @@ pub struct Secret { 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 = ""; diff --git a/src/v1_27/api/core/v1/service.rs b/src/v1_27/api/core/v1/service.rs index d5b201c7a6..4add73225c 100644 --- a/src/v1_27/api/core/v1/service.rs +++ b/src/v1_27/api/core/v1/service.rs @@ -13,1169 +13,6 @@ pub struct Service { 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 = ""; diff --git a/src/v1_27/api/core/v1/service_account.rs b/src/v1_27/api/core/v1/service_account.rs index 1f966964fe..f9cc91ab51 100644 --- a/src/v1_27/api/core/v1/service_account.rs +++ b/src/v1_27/api/core/v1/service_account.rs @@ -16,458 +16,6 @@ pub struct ServiceAccount { 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 = ""; diff --git a/src/v1_27/api/discovery/v1/endpoint_slice.rs b/src/v1_27/api/discovery/v1/endpoint_slice.rs index 1b8cbdf143..f13a66d1ba 100644 --- a/src/v1_27/api/discovery/v1/endpoint_slice.rs +++ b/src/v1_27/api/discovery/v1/endpoint_slice.rs @@ -16,458 +16,6 @@ pub struct EndpointSlice { 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"; diff --git a/src/v1_27/api/discovery/v1/mod.rs b/src/v1_27/api/discovery/v1/mod.rs index 4f95e39509..fea33c6ba5 100644 --- a/src/v1_27/api/discovery/v1/mod.rs +++ b/src/v1_27/api/discovery/v1/mod.rs @@ -13,7 +13,6 @@ 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_27/api/events/v1/event.rs b/src/v1_27/api/events/v1/event.rs index 2d020b9ab1..ce3627cf1b 100644 --- a/src/v1_27/api/events/v1/event.rs +++ b/src/v1_27/api/events/v1/event.rs @@ -49,458 +49,6 @@ pub struct Event { 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"; diff --git a/src/v1_27/api/events/v1/mod.rs b/src/v1_27/api/events/v1/mod.rs index df97b5fd8e..e1dfabbd9f 100644 --- a/src/v1_27/api/events/v1/mod.rs +++ b/src/v1_27/api/events/v1/mod.rs @@ -1,7 +1,6 @@ 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_27/api/flowcontrol/v1beta2/flow_schema.rs b/src/v1_27/api/flowcontrol/v1beta2/flow_schema.rs index 71d13230a3..bb9f5a3a92 100644 --- a/src/v1_27/api/flowcontrol/v1beta2/flow_schema.rs +++ b/src/v1_27/api/flowcontrol/v1beta2/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { 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"; diff --git a/src/v1_27/api/flowcontrol/v1beta2/mod.rs b/src/v1_27/api/flowcontrol/v1beta2/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_27/api/flowcontrol/v1beta2/mod.rs +++ b/src/v1_27/api/flowcontrol/v1beta2/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_27/api/flowcontrol/v1beta2/priority_level_configuration.rs b/src/v1_27/api/flowcontrol/v1beta2/priority_level_configuration.rs index 91ebc9f1f5..2f8bb6a7cc 100644 --- a/src/v1_27/api/flowcontrol/v1beta2/priority_level_configuration.rs +++ b/src/v1_27/api/flowcontrol/v1beta2/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { 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"; diff --git a/src/v1_27/api/flowcontrol/v1beta3/flow_schema.rs b/src/v1_27/api/flowcontrol/v1beta3/flow_schema.rs index 4890a5dcdc..4c0d0a63d4 100644 --- a/src/v1_27/api/flowcontrol/v1beta3/flow_schema.rs +++ b/src/v1_27/api/flowcontrol/v1beta3/flow_schema.rs @@ -13,495 +13,6 @@ pub struct FlowSchema { pub status: Option, } -// Begin flowcontrol.apiserver.k8s.io/v1beta3/FlowSchema - -// Generated from operation createFlowcontrolApiserverV1beta3FlowSchema - -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::v1beta3::FlowSchema, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 deleteFlowcontrolApiserverV1beta3CollectionFlowSchema - -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/v1beta3/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 deleteFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 listFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3FlowSchemaStatus - -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/v1beta3/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 readFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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::v1beta3::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 readFlowcontrolApiserverV1beta3FlowSchemaStatus - -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/v1beta3/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::v1beta3::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 replaceFlowcontrolApiserverV1beta3FlowSchema - -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::v1beta3::FlowSchema, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 replaceFlowcontrolApiserverV1beta3FlowSchemaStatus - -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::v1beta3::FlowSchema, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 watchFlowcontrolApiserverV1beta3FlowSchema - -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/v1beta3/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/v1beta3/FlowSchema - impl crate::Resource for FlowSchema { const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; diff --git a/src/v1_27/api/flowcontrol/v1beta3/mod.rs b/src/v1_27/api/flowcontrol/v1beta3/mod.rs index 2c08d5bd64..1c4914f963 100644 --- a/src/v1_27/api/flowcontrol/v1beta3/mod.rs +++ b/src/v1_27/api/flowcontrol/v1beta3/mod.rs @@ -4,8 +4,6 @@ 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; @@ -33,8 +31,6 @@ 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; diff --git a/src/v1_27/api/flowcontrol/v1beta3/priority_level_configuration.rs b/src/v1_27/api/flowcontrol/v1beta3/priority_level_configuration.rs index 381c85611d..4a78256215 100644 --- a/src/v1_27/api/flowcontrol/v1beta3/priority_level_configuration.rs +++ b/src/v1_27/api/flowcontrol/v1beta3/priority_level_configuration.rs @@ -13,495 +13,6 @@ pub struct PriorityLevelConfiguration { pub status: Option, } -// Begin flowcontrol.apiserver.k8s.io/v1beta3/PriorityLevelConfiguration - -// Generated from operation createFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 deleteFlowcontrolApiserverV1beta3CollectionPriorityLevelConfiguration - -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/v1beta3/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 deleteFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 listFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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 patchFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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/v1beta3/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 readFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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::v1beta3::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 readFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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/v1beta3/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::v1beta3::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 replaceFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 replaceFlowcontrolApiserverV1beta3PriorityLevelConfigurationStatus - -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::v1beta3::PriorityLevelConfiguration, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/flowcontrol.apiserver.k8s.io/v1beta3/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 watchFlowcontrolApiserverV1beta3PriorityLevelConfiguration - -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/v1beta3/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/v1beta3/PriorityLevelConfiguration - impl crate::Resource for PriorityLevelConfiguration { const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; diff --git a/src/v1_27/api/networking/v1/ingress.rs b/src/v1_27/api/networking/v1/ingress.rs index c18da1d6fc..d72d528e5a 100644 --- a/src/v1_27/api/networking/v1/ingress.rs +++ b/src/v1_27/api/networking/v1/ingress.rs @@ -13,629 +13,6 @@ pub struct Ingress { 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"; diff --git a/src/v1_27/api/networking/v1/ingress_class.rs b/src/v1_27/api/networking/v1/ingress_class.rs index fbd1ad37ac..bf1ae1e4de 100644 --- a/src/v1_27/api/networking/v1/ingress_class.rs +++ b/src/v1_27/api/networking/v1/ingress_class.rs @@ -10,342 +10,6 @@ pub struct IngressClass { 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"; diff --git a/src/v1_27/api/networking/v1/mod.rs b/src/v1_27/api/networking/v1/mod.rs index a7c2de91e6..9271b371de 100644 --- a/src/v1_27/api/networking/v1/mod.rs +++ b/src/v1_27/api/networking/v1/mod.rs @@ -10,15 +10,12 @@ 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; @@ -52,8 +49,6 @@ 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; diff --git a/src/v1_27/api/networking/v1/network_policy.rs b/src/v1_27/api/networking/v1/network_policy.rs index 8e6ee6590e..8ad31296bb 100644 --- a/src/v1_27/api/networking/v1/network_policy.rs +++ b/src/v1_27/api/networking/v1/network_policy.rs @@ -13,629 +13,6 @@ pub struct NetworkPolicy { 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"; diff --git a/src/v1_27/api/networking/v1alpha1/cluster_cidr.rs b/src/v1_27/api/networking/v1alpha1/cluster_cidr.rs index 3a9028bcd8..696d22ec0a 100644 --- a/src/v1_27/api/networking/v1alpha1/cluster_cidr.rs +++ b/src/v1_27/api/networking/v1alpha1/cluster_cidr.rs @@ -10,342 +10,6 @@ pub struct ClusterCIDR { 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"; diff --git a/src/v1_27/api/networking/v1alpha1/ip_address.rs b/src/v1_27/api/networking/v1alpha1/ip_address.rs index 39c445ce72..c157716ea5 100644 --- a/src/v1_27/api/networking/v1alpha1/ip_address.rs +++ b/src/v1_27/api/networking/v1alpha1/ip_address.rs @@ -10,342 +10,6 @@ pub struct IPAddress { pub spec: Option, } -// Begin networking.k8s.io/v1alpha1/IPAddress - -// Generated from operation createNetworkingV1alpha1IPAddress - -impl IPAddress { - /// create an IPAddress - /// - /// 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::IPAddress, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/networking.k8s.io/v1alpha1/ipaddresses?".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 deleteNetworkingV1alpha1CollectionIPAddress - -impl IPAddress { - /// delete collection of IPAddress - /// - /// 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/ipaddresses?".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 deleteNetworkingV1alpha1IPAddress - -impl IPAddress { - /// delete an IPAddress - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the IPAddress - /// - /// * `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/ipaddresses/{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 listNetworkingV1alpha1IPAddress - -impl IPAddress { - /// list or watch objects of kind IPAddress - /// - /// 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/ipaddresses?".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 patchNetworkingV1alpha1IPAddress - -impl IPAddress { - /// partially update the specified IPAddress - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the IPAddress - /// - /// * `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/ipaddresses/{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 readNetworkingV1alpha1IPAddress - -impl IPAddress { - /// read the specified IPAddress - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadIPAddressResponse`]`>` constructor, or [`ReadIPAddressResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the IPAddress - #[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/ipaddresses/{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 [`IPAddress::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadIPAddressResponse { - Ok(crate::api::networking::v1alpha1::IPAddress), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadIPAddressResponse { - 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((ReadIPAddressResponse::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((ReadIPAddressResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceNetworkingV1alpha1IPAddress - -impl IPAddress { - /// replace the specified IPAddress - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the IPAddress - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::networking::v1alpha1::IPAddress, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/networking.k8s.io/v1alpha1/ipaddresses/{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 watchNetworkingV1alpha1IPAddress - -impl IPAddress { - /// list or watch objects of kind IPAddress - /// - /// 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/ipaddresses?".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/IPAddress - impl crate::Resource for IPAddress { const API_VERSION: &'static str = "networking.k8s.io/v1alpha1"; const GROUP: &'static str = "networking.k8s.io"; diff --git a/src/v1_27/api/networking/v1alpha1/mod.rs b/src/v1_27/api/networking/v1alpha1/mod.rs index efd1f0231b..a580e11c12 100644 --- a/src/v1_27/api/networking/v1alpha1/mod.rs +++ b/src/v1_27/api/networking/v1alpha1/mod.rs @@ -1,14 +1,12 @@ 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; mod ip_address; pub use self::ip_address::IPAddress; -#[cfg(feature = "api")] pub use self::ip_address::ReadIPAddressResponse; mod ip_address_spec; pub use self::ip_address_spec::IPAddressSpec; diff --git a/src/v1_27/api/node/v1/mod.rs b/src/v1_27/api/node/v1/mod.rs index a96372fa96..08a4d1cb9f 100644 --- a/src/v1_27/api/node/v1/mod.rs +++ b/src/v1_27/api/node/v1/mod.rs @@ -4,7 +4,6 @@ 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_27/api/node/v1/runtime_class.rs b/src/v1_27/api/node/v1/runtime_class.rs index 7f1f2c3694..fc3830dac3 100644 --- a/src/v1_27/api/node/v1/runtime_class.rs +++ b/src/v1_27/api/node/v1/runtime_class.rs @@ -17,342 +17,6 @@ pub struct RuntimeClass { 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"; diff --git a/src/v1_27/api/policy/v1/eviction.rs b/src/v1_27/api/policy/v1/eviction.rs index e92ebe2f3a..00a4e8a25d 100644 --- a/src/v1_27/api/policy/v1/eviction.rs +++ b/src/v1_27/api/policy/v1/eviction.rs @@ -10,57 +10,6 @@ pub struct Eviction { 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"; diff --git a/src/v1_27/api/policy/v1/mod.rs b/src/v1_27/api/policy/v1/mod.rs index 5514146684..4b9d97c5dc 100644 --- a/src/v1_27/api/policy/v1/mod.rs +++ b/src/v1_27/api/policy/v1/mod.rs @@ -4,8 +4,6 @@ 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; diff --git a/src/v1_27/api/policy/v1/pod_disruption_budget.rs b/src/v1_27/api/policy/v1/pod_disruption_budget.rs index 72f7294f71..eaf5f61e3a 100644 --- a/src/v1_27/api/policy/v1/pod_disruption_budget.rs +++ b/src/v1_27/api/policy/v1/pod_disruption_budget.rs @@ -13,629 +13,6 @@ pub struct 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"; diff --git a/src/v1_27/api/rbac/v1/cluster_role.rs b/src/v1_27/api/rbac/v1/cluster_role.rs index a6f832b593..7d4e53ed17 100644 --- a/src/v1_27/api/rbac/v1/cluster_role.rs +++ b/src/v1_27/api/rbac/v1/cluster_role.rs @@ -13,342 +13,6 @@ pub struct 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"; diff --git a/src/v1_27/api/rbac/v1/cluster_role_binding.rs b/src/v1_27/api/rbac/v1/cluster_role_binding.rs index 04fa2bd714..f35ae335c2 100644 --- a/src/v1_27/api/rbac/v1/cluster_role_binding.rs +++ b/src/v1_27/api/rbac/v1/cluster_role_binding.rs @@ -13,342 +13,6 @@ pub struct ClusterRoleBinding { 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"; diff --git a/src/v1_27/api/rbac/v1/mod.rs b/src/v1_27/api/rbac/v1/mod.rs index b4d2cf36ca..b714208deb 100644 --- a/src/v1_27/api/rbac/v1/mod.rs +++ b/src/v1_27/api/rbac/v1/mod.rs @@ -4,22 +4,18 @@ 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; diff --git a/src/v1_27/api/rbac/v1/role.rs b/src/v1_27/api/rbac/v1/role.rs index 719ecb92b0..b5ac25bdda 100644 --- a/src/v1_27/api/rbac/v1/role.rs +++ b/src/v1_27/api/rbac/v1/role.rs @@ -10,458 +10,6 @@ pub struct 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"; diff --git a/src/v1_27/api/rbac/v1/role_binding.rs b/src/v1_27/api/rbac/v1/role_binding.rs index 7b9059076a..b03075de23 100644 --- a/src/v1_27/api/rbac/v1/role_binding.rs +++ b/src/v1_27/api/rbac/v1/role_binding.rs @@ -13,458 +13,6 @@ pub struct RoleBinding { 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"; diff --git a/src/v1_27/api/resource/v1alpha2/mod.rs b/src/v1_27/api/resource/v1alpha2/mod.rs index de8b810c44..307e202f7f 100644 --- a/src/v1_27/api/resource/v1alpha2/mod.rs +++ b/src/v1_27/api/resource/v1alpha2/mod.rs @@ -4,8 +4,6 @@ pub use self::allocation_result::AllocationResult; mod pod_scheduling_context; pub use self::pod_scheduling_context::PodSchedulingContext; -#[cfg(feature = "api")] pub use self::pod_scheduling_context::ReadPodSchedulingContextResponse; -#[cfg(feature = "api")] pub use self::pod_scheduling_context::ReadPodSchedulingContextStatusResponse; mod pod_scheduling_context_spec; pub use self::pod_scheduling_context_spec::PodSchedulingContextSpec; @@ -15,8 +13,6 @@ pub use self::pod_scheduling_context_status::PodSchedulingContextStatus; mod resource_claim; pub use self::resource_claim::ResourceClaim; -#[cfg(feature = "api")] pub use self::resource_claim::ReadResourceClaimResponse; -#[cfg(feature = "api")] pub use self::resource_claim::ReadResourceClaimStatusResponse; mod resource_claim_consumer_reference; pub use self::resource_claim_consumer_reference::ResourceClaimConsumerReference; @@ -35,14 +31,12 @@ pub use self::resource_claim_status::ResourceClaimStatus; mod resource_claim_template; pub use self::resource_claim_template::ResourceClaimTemplate; -#[cfg(feature = "api")] pub use self::resource_claim_template::ReadResourceClaimTemplateResponse; mod resource_claim_template_spec; pub use self::resource_claim_template_spec::ResourceClaimTemplateSpec; mod resource_class; pub use self::resource_class::ResourceClass; -#[cfg(feature = "api")] pub use self::resource_class::ReadResourceClassResponse; mod resource_class_parameters_reference; pub use self::resource_class_parameters_reference::ResourceClassParametersReference; diff --git a/src/v1_27/api/resource/v1alpha2/pod_scheduling_context.rs b/src/v1_27/api/resource/v1alpha2/pod_scheduling_context.rs index 21a152d188..0790513819 100644 --- a/src/v1_27/api/resource/v1alpha2/pod_scheduling_context.rs +++ b/src/v1_27/api/resource/v1alpha2/pod_scheduling_context.rs @@ -15,629 +15,6 @@ pub struct PodSchedulingContext { pub status: Option, } -// Begin resource.k8s.io/v1alpha2/PodSchedulingContext - -// Generated from operation createResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// create a PodSchedulingContext - /// - /// 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::resource::v1alpha2::PodSchedulingContext, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts?", - namespace = crate::percent_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 deleteResourceV1alpha2CollectionNamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// delete collection of PodSchedulingContext - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts?", - namespace = crate::percent_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 deleteResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// delete a PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 listResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// list or watch objects of kind PodSchedulingContext - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts?", - namespace = crate::percent_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 listResourceV1alpha2PodSchedulingContextForAllNamespaces - -impl PodSchedulingContext { - /// list or watch objects of kind PodSchedulingContext - /// - /// 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/resource.k8s.io/v1alpha2/podschedulingcontexts?".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 patchResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// partially update the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 patchResourceV1alpha2NamespacedPodSchedulingContextStatus - -impl PodSchedulingContext { - /// partially update status of the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 readResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// read the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSchedulingContextResponse`]`>` constructor, or [`ReadPodSchedulingContextResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 [`PodSchedulingContext::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSchedulingContextResponse { - Ok(crate::api::resource::v1alpha2::PodSchedulingContext), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSchedulingContextResponse { - 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((ReadPodSchedulingContextResponse::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((ReadPodSchedulingContextResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation readResourceV1alpha2NamespacedPodSchedulingContextStatus - -impl PodSchedulingContext { - /// read status of the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadPodSchedulingContextStatusResponse`]`>` constructor, or [`ReadPodSchedulingContextStatusResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 [`PodSchedulingContext::read_status`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadPodSchedulingContextStatusResponse { - Ok(crate::api::resource::v1alpha2::PodSchedulingContext), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadPodSchedulingContextStatusResponse { - 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((ReadPodSchedulingContextStatusResponse::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((ReadPodSchedulingContextStatusResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// replace the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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::resource::v1alpha2::PodSchedulingContext, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 replaceResourceV1alpha2NamespacedPodSchedulingContextStatus - -impl PodSchedulingContext { - /// replace status of the specified PodSchedulingContext - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the PodSchedulingContext - /// - /// * `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::resource::v1alpha2::PodSchedulingContext, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts/{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 watchResourceV1alpha2NamespacedPodSchedulingContext - -impl PodSchedulingContext { - /// list or watch objects of kind PodSchedulingContext - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/podschedulingcontexts?", - namespace = crate::percent_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 watchResourceV1alpha2PodSchedulingContextForAllNamespaces - -impl PodSchedulingContext { - /// list or watch objects of kind PodSchedulingContext - /// - /// 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/resource.k8s.io/v1alpha2/podschedulingcontexts?".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 resource.k8s.io/v1alpha2/PodSchedulingContext - impl crate::Resource for PodSchedulingContext { const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_27/api/resource/v1alpha2/resource_claim.rs b/src/v1_27/api/resource/v1alpha2/resource_claim.rs index f9f3fe3dd2..a8e81951ee 100644 --- a/src/v1_27/api/resource/v1alpha2/resource_claim.rs +++ b/src/v1_27/api/resource/v1alpha2/resource_claim.rs @@ -15,629 +15,6 @@ pub struct ResourceClaim { pub status: Option, } -// Begin resource.k8s.io/v1alpha2/ResourceClaim - -// Generated from operation createResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// create a ResourceClaim - /// - /// 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::resource::v1alpha2::ResourceClaim, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 deleteResourceV1alpha2CollectionNamespacedResourceClaim - -impl ResourceClaim { - /// delete collection of ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 deleteResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// delete a ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 listResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 listResourceV1alpha2ResourceClaimForAllNamespaces - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha2/resourceclaims?".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 patchResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// partially update the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 patchResourceV1alpha2NamespacedResourceClaimStatus - -impl ResourceClaim { - /// partially update status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 readResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// read the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimResponse`]`>` constructor, or [`ReadResourceClaimResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 [`ResourceClaim::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimResponse { - Ok(crate::api::resource::v1alpha2::ResourceClaim), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimResponse { - 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((ReadResourceClaimResponse::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((ReadResourceClaimResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation readResourceV1alpha2NamespacedResourceClaimStatus - -impl ResourceClaim { - /// read status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimStatusResponse`]`>` constructor, or [`ReadResourceClaimStatusResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 [`ResourceClaim::read_status`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimStatusResponse { - Ok(crate::api::resource::v1alpha2::ResourceClaim), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimStatusResponse { - 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((ReadResourceClaimStatusResponse::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((ReadResourceClaimStatusResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// replace the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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::resource::v1alpha2::ResourceClaim, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 replaceResourceV1alpha2NamespacedResourceClaimStatus - -impl ResourceClaim { - /// replace status of the specified ResourceClaim - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaim - /// - /// * `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::resource::v1alpha2::ResourceClaim, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims/{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 watchResourceV1alpha2NamespacedResourceClaim - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaims?", - namespace = crate::percent_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 watchResourceV1alpha2ResourceClaimForAllNamespaces - -impl ResourceClaim { - /// list or watch objects of kind ResourceClaim - /// - /// 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/resource.k8s.io/v1alpha2/resourceclaims?".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 resource.k8s.io/v1alpha2/ResourceClaim - impl crate::Resource for ResourceClaim { const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_27/api/resource/v1alpha2/resource_claim_template.rs b/src/v1_27/api/resource/v1alpha2/resource_claim_template.rs index b6faf7145c..636cf54169 100644 --- a/src/v1_27/api/resource/v1alpha2/resource_claim_template.rs +++ b/src/v1_27/api/resource/v1alpha2/resource_claim_template.rs @@ -12,458 +12,6 @@ pub struct ResourceClaimTemplate { pub spec: crate::api::resource::v1alpha2::ResourceClaimTemplateSpec, } -// Begin resource.k8s.io/v1alpha2/ResourceClaimTemplate - -// Generated from operation createResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// create a ResourceClaimTemplate - /// - /// 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::resource::v1alpha2::ResourceClaimTemplate, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 deleteResourceV1alpha2CollectionNamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// delete collection of ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 deleteResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// delete a ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates/{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 listResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 listResourceV1alpha2ResourceClaimTemplateForAllNamespaces - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha2/resourceclaimtemplates?".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 patchResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// partially update the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates/{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 readResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// read the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClaimTemplateResponse`]`>` constructor, or [`ReadResourceClaimTemplateResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates/{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 [`ResourceClaimTemplate::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClaimTemplateResponse { - Ok(crate::api::resource::v1alpha2::ResourceClaimTemplate), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClaimTemplateResponse { - 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((ReadResourceClaimTemplateResponse::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((ReadResourceClaimTemplateResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// replace the specified ResourceClaimTemplate - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClaimTemplate - /// - /// * `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::resource::v1alpha2::ResourceClaimTemplate, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates/{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 watchResourceV1alpha2NamespacedResourceClaimTemplate - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha2/namespaces/{namespace}/resourceclaimtemplates?", - namespace = crate::percent_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 watchResourceV1alpha2ResourceClaimTemplateForAllNamespaces - -impl ResourceClaimTemplate { - /// list or watch objects of kind ResourceClaimTemplate - /// - /// 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/resource.k8s.io/v1alpha2/resourceclaimtemplates?".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 resource.k8s.io/v1alpha2/ResourceClaimTemplate - impl crate::Resource for ResourceClaimTemplate { const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_27/api/resource/v1alpha2/resource_class.rs b/src/v1_27/api/resource/v1alpha2/resource_class.rs index 0a496ba51e..a95b908f3e 100644 --- a/src/v1_27/api/resource/v1alpha2/resource_class.rs +++ b/src/v1_27/api/resource/v1alpha2/resource_class.rs @@ -22,342 +22,6 @@ pub struct ResourceClass { pub suitable_nodes: Option, } -// Begin resource.k8s.io/v1alpha2/ResourceClass - -// Generated from operation createResourceV1alpha2ResourceClass - -impl ResourceClass { - /// create a ResourceClass - /// - /// 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::resource::v1alpha2::ResourceClass, - optional: crate::CreateOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = "/apis/resource.k8s.io/v1alpha2/resourceclasses?".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 deleteResourceV1alpha2CollectionResourceClass - -impl ResourceClass { - /// delete collection of ResourceClass - /// - /// 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/resource.k8s.io/v1alpha2/resourceclasses?".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 deleteResourceV1alpha2ResourceClass - -impl ResourceClass { - /// delete a ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::DeleteResponse`]`>` constructor, or [`crate::DeleteResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `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/resource.k8s.io/v1alpha2/resourceclasses/{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 listResourceV1alpha2ResourceClass - -impl ResourceClass { - /// list or watch objects of kind ResourceClass - /// - /// 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/resource.k8s.io/v1alpha2/resourceclasses?".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 patchResourceV1alpha2ResourceClass - -impl ResourceClass { - /// partially update the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::PatchResponse`]`>` constructor, or [`crate::PatchResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `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/resource.k8s.io/v1alpha2/resourceclasses/{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 readResourceV1alpha2ResourceClass - -impl ResourceClass { - /// read the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`ReadResourceClassResponse`]`>` constructor, or [`ReadResourceClassResponse`] directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - #[cfg(feature = "api")] - pub fn read( - name: &str, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/resourceclasses/{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 [`ResourceClass::read`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum ReadResourceClassResponse { - Ok(crate::api::resource::v1alpha2::ResourceClass), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for ReadResourceClassResponse { - 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((ReadResourceClassResponse::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((ReadResourceClassResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation replaceResourceV1alpha2ResourceClass - -impl ResourceClass { - /// replace the specified ResourceClass - /// - /// Use the returned [`crate::ResponseBody`]`<`[`crate::ReplaceResponse`]`>` constructor, or [`crate::ReplaceResponse`]`` directly, to parse the HTTP response. - /// - /// # Arguments - /// - /// * `name` - /// - /// name of the ResourceClass - /// - /// * `body` - /// - /// * `optional` - /// - /// Optional parameters. Use `Default::default()` to not pass any. - #[cfg(feature = "api")] - pub fn replace( - name: &str, - body: &crate::api::resource::v1alpha2::ResourceClass, - optional: crate::ReplaceOptional<'_>, - ) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody>), crate::RequestError> { - let __url = format!("/apis/resource.k8s.io/v1alpha2/resourceclasses/{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 watchResourceV1alpha2ResourceClass - -impl ResourceClass { - /// list or watch objects of kind ResourceClass - /// - /// 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/resource.k8s.io/v1alpha2/resourceclasses?".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 resource.k8s.io/v1alpha2/ResourceClass - impl crate::Resource for ResourceClass { const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; const GROUP: &'static str = "resource.k8s.io"; diff --git a/src/v1_27/api/scheduling/v1/mod.rs b/src/v1_27/api/scheduling/v1/mod.rs index 3780873f3e..30113f1bcb 100644 --- a/src/v1_27/api/scheduling/v1/mod.rs +++ b/src/v1_27/api/scheduling/v1/mod.rs @@ -1,4 +1,3 @@ mod priority_class; pub use self::priority_class::PriorityClass; -#[cfg(feature = "api")] pub use self::priority_class::ReadPriorityClassResponse; diff --git a/src/v1_27/api/scheduling/v1/priority_class.rs b/src/v1_27/api/scheduling/v1/priority_class.rs index f80143b0e0..584572de1c 100644 --- a/src/v1_27/api/scheduling/v1/priority_class.rs +++ b/src/v1_27/api/scheduling/v1/priority_class.rs @@ -19,342 +19,6 @@ pub struct PriorityClass { 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"; diff --git a/src/v1_27/api/storage/v1/csi_driver.rs b/src/v1_27/api/storage/v1/csi_driver.rs index 66210fc4eb..3f9d33cd82 100644 --- a/src/v1_27/api/storage/v1/csi_driver.rs +++ b/src/v1_27/api/storage/v1/csi_driver.rs @@ -10,342 +10,6 @@ pub struct CSIDriver { 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"; diff --git a/src/v1_27/api/storage/v1/csi_node.rs b/src/v1_27/api/storage/v1/csi_node.rs index 78d2172a9b..c55f473b6e 100644 --- a/src/v1_27/api/storage/v1/csi_node.rs +++ b/src/v1_27/api/storage/v1/csi_node.rs @@ -10,342 +10,6 @@ pub struct 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"; diff --git a/src/v1_27/api/storage/v1/csi_storage_capacity.rs b/src/v1_27/api/storage/v1/csi_storage_capacity.rs index 9605ec1825..94e6e2b2c4 100644 --- a/src/v1_27/api/storage/v1/csi_storage_capacity.rs +++ b/src/v1_27/api/storage/v1/csi_storage_capacity.rs @@ -35,458 +35,6 @@ pub struct CSIStorageCapacity { 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"; diff --git a/src/v1_27/api/storage/v1/mod.rs b/src/v1_27/api/storage/v1/mod.rs index 673d1d25b1..f0961497d2 100644 --- a/src/v1_27/api/storage/v1/mod.rs +++ b/src/v1_27/api/storage/v1/mod.rs @@ -1,14 +1,12 @@ 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; @@ -18,19 +16,15 @@ 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; diff --git a/src/v1_27/api/storage/v1/storage_class.rs b/src/v1_27/api/storage/v1/storage_class.rs index bd351b05a7..5782053f9b 100644 --- a/src/v1_27/api/storage/v1/storage_class.rs +++ b/src/v1_27/api/storage/v1/storage_class.rs @@ -30,342 +30,6 @@ pub struct StorageClass { 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"; diff --git a/src/v1_27/api/storage/v1/volume_attachment.rs b/src/v1_27/api/storage/v1/volume_attachment.rs index 2849c52a25..4fae0f2f24 100644 --- a/src/v1_27/api/storage/v1/volume_attachment.rs +++ b/src/v1_27/api/storage/v1/volume_attachment.rs @@ -15,495 +15,6 @@ pub struct VolumeAttachment { 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"; diff --git a/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs index c05e8ea174..be33903b77 100644 --- a/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs +++ b/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -13,495 +13,6 @@ pub struct 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"; diff --git a/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs index 658cc6488f..25a7b1e212 100644 --- a/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs +++ b/src/v1_27/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -7,8 +7,6 @@ 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; diff --git a/src/v1_27/create_optional.rs b/src/v1_27/create_optional.rs deleted file mode 100644 index 496907366a..0000000000 --- a/src/v1_27/create_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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. 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. - 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 in v1.23+ - 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_27/create_response.rs b/src/v1_27/create_response.rs deleted file mode 100644 index e14f340ca4..0000000000 --- a/src/v1_27/create_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// 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_27/delete_optional.rs b/src/v1_27/delete_optional.rs deleted file mode 100644 index 9f986148bc..0000000000 --- a/src/v1_27/delete_optional.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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_27/delete_response.rs b/src/v1_27/delete_response.rs deleted file mode 100644 index d983465bd8..0000000000 --- a/src/v1_27/delete_response.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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_27/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs index cff7ff1489..2496a52cf4 100644 --- a/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs +++ b/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -13,495 +13,6 @@ pub struct APIService { 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"; diff --git a/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs index e48afb5807..57d836af46 100644 --- a/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs +++ b/src/v1_27/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/src/v1_27/list_optional.rs b/src/v1_27/list_optional.rs deleted file mode 100644 index b7e631d5ba..0000000000 --- a/src/v1_27/list_optional.rs +++ /dev/null @@ -1,69 +0,0 @@ -// 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_27/list_response.rs b/src/v1_27/list_response.rs deleted file mode 100644 index a7b671f29c..0000000000 --- a/src/v1_27/list_response.rs +++ /dev/null @@ -1,39 +0,0 @@ -// 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_27/mod.rs b/src/v1_27/mod.rs index a175869b05..27088faf3b 100644 --- a/src/v1_27/mod.rs +++ b/src/v1_27/mod.rs @@ -1,67 +1,7 @@ -#[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; @@ -69,3202 +9,3 @@ 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 getAdmissionregistrationV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAdmissionregistrationV1alpha1APIResourcesResponse`]`>` constructor, or [`GetAdmissionregistrationV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_admissionregistration_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/admissionregistration.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_admissionregistration_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAdmissionregistrationV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAdmissionregistrationV1alpha1APIResourcesResponse { - 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((GetAdmissionregistrationV1alpha1APIResourcesResponse::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((GetAdmissionregistrationV1alpha1APIResourcesResponse::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 getAuthenticationV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthenticationV1alpha1APIResourcesResponse`]`>` constructor, or [`GetAuthenticationV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_authentication_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/authentication.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_authentication_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAuthenticationV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAuthenticationV1alpha1APIResourcesResponse { - 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((GetAuthenticationV1alpha1APIResourcesResponse::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((GetAuthenticationV1alpha1APIResourcesResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation getAuthenticationV1beta1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetAuthenticationV1beta1APIResourcesResponse`]`>` constructor, or [`GetAuthenticationV1beta1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_authentication_v1beta1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/authentication.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_authentication_v1beta1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetAuthenticationV1beta1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetAuthenticationV1beta1APIResourcesResponse { - 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((GetAuthenticationV1beta1APIResourcesResponse::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((GetAuthenticationV1beta1APIResourcesResponse::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 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 getCertificatesV1alpha1APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetCertificatesV1alpha1APIResourcesResponse`]`>` constructor, or [`GetCertificatesV1alpha1APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_certificates_v1alpha1_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/certificates.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_certificates_v1alpha1_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetCertificatesV1alpha1APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetCertificatesV1alpha1APIResourcesResponse { - 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((GetCertificatesV1alpha1APIResourcesResponse::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((GetCertificatesV1alpha1APIResourcesResponse::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 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 getFlowcontrolApiserverV1beta3APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetFlowcontrolApiserverV1beta3APIResourcesResponse`]`>` constructor, or [`GetFlowcontrolApiserverV1beta3APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_flowcontrol_apiserver_v1beta3_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/flowcontrol.apiserver.k8s.io/v1beta3/".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_v1beta3_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetFlowcontrolApiserverV1beta3APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetFlowcontrolApiserverV1beta3APIResourcesResponse { - 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((GetFlowcontrolApiserverV1beta3APIResourcesResponse::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((GetFlowcontrolApiserverV1beta3APIResourcesResponse::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 getResourceAPIGroup - -/// get information of a group -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetResourceAPIGroupResponse`]`>` constructor, or [`GetResourceAPIGroupResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_resource_api_group( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/resource.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_resource_api_group`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetResourceAPIGroupResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIGroup), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetResourceAPIGroupResponse { - 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((GetResourceAPIGroupResponse::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((GetResourceAPIGroupResponse::Other(result), read)) - }, - } - } -} - -// Generated from operation getResourceV1alpha2APIResources - -/// get available resources -/// -/// Use the returned [`crate::ResponseBody`]`<`[`GetResourceV1alpha2APIResourcesResponse`]`>` constructor, or [`GetResourceV1alpha2APIResourcesResponse`] directly, to parse the HTTP response. -#[cfg(feature = "api")] -pub fn get_resource_v1alpha2_api_resources( -) -> Result<(crate::http::Request>, fn(crate::http::StatusCode) -> crate::ResponseBody), crate::RequestError> { - let __url = "/apis/resource.k8s.io/v1alpha2/".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_resource_v1alpha2_api_resources`] -#[cfg(feature = "api")] -#[derive(Debug)] -pub enum GetResourceV1alpha2APIResourcesResponse { - Ok(crate::apimachinery::pkg::apis::meta::v1::APIResourceList), - Other(Result, crate::serde_json::Error>), -} - -#[cfg(feature = "api")] -impl crate::Response for GetResourceV1alpha2APIResourcesResponse { - 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((GetResourceV1alpha2APIResourcesResponse::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((GetResourceV1alpha2APIResourcesResponse::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 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_27/patch_optional.rs b/src/v1_27/patch_optional.rs deleted file mode 100644 index f5674c2328..0000000000 --- a/src/v1_27/patch_optional.rs +++ /dev/null @@ -1,43 +0,0 @@ -// 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. 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. - 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 in v1.23+ - 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_27/patch_response.rs b/src/v1_27/patch_response.rs deleted file mode 100644 index d733843676..0000000000 --- a/src/v1_27/patch_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_27/replace_optional.rs b/src/v1_27/replace_optional.rs deleted file mode 100644 index d8f32861a0..0000000000 --- a/src/v1_27/replace_optional.rs +++ /dev/null @@ -1,37 +0,0 @@ -// 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. 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. - 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 in v1.23+ - 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_27/replace_response.rs b/src/v1_27/replace_response.rs deleted file mode 100644 index bdbb0b341d..0000000000 --- a/src/v1_27/replace_response.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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_27/watch_optional.rs b/src/v1_27/watch_optional.rs deleted file mode 100644 index 3e365508e0..0000000000 --- a/src/v1_27/watch_optional.rs +++ /dev/null @@ -1,78 +0,0 @@ -// 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>, - - /// 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>, - - /// `sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic "Bookmark" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched. - /// - /// When `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan - /// is interpreted as "data at least as new as the provided `resourceVersion`" - /// and the bookmark event is send when the state is synced - /// to a `resourceVersion` at least as fresh as the one provided by the ListOptions. - /// If `resourceVersion` is unset, this is interpreted as "consistent read" and the - /// bookmark event is send when the state is synced at least to the moment - /// when request started being processed. - /// - `resourceVersionMatch` set to any other value or unset - /// Invalid error is returned. - /// - /// Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward compatibility reasons) and to false otherwise. - pub send_initial_events: Option, - - /// 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.resource_version_match { - __query_pairs.append_pair("resourceVersionMatch", value); - } - if let Some(value) = self.send_initial_events { - __query_pairs.append_pair("sendInitialEvents", if value { "true" } else { "false" }); - } - 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_27/watch_response.rs b/src/v1_27/watch_response.rs deleted file mode 100644 index f8e1ddf9e2..0000000000 --- a/src/v1_27/watch_response.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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)) - }, - } - } -}